You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by de...@apache.org on 2016/02/22 13:20:14 UTC
[01/11] jclouds-labs git commit: Remove ProfitBricks
Repository: jclouds-labs
Updated Branches:
refs/heads/master 7b8adc624 -> 93aff9219
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/image/images.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/image/images.xml b/profitbricks/src/test/resources/image/images.xml
deleted file mode 100644
index 5e09a1d..0000000
--- a/profitbricks/src/test/resources/image/images.xml
+++ /dev/null
@@ -1,140 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getAllImagesResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <bootable>true</bootable>
- <cpuHotPlug>true</cpuHotPlug>
- <cpuHotUnPlug>false</cpuHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- <imageId>e4f73936-9161-11e4-9d74-52540066fee9</imageId>
- <imageName>Ubuntu-12.04-LTS-server-2015-01-01</imageName>
- <imageSize>2048</imageSize>
- <imageType>HDD</imageType>
- <location>de/fra</location>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <osType>LINUX</osType>
- <public>true</public>
- <ramHotPlug>true</ramHotPlug>
- <ramHotUnPlug>false</ramHotUnPlug>
- <writeable>true</writeable>
- </return>
- <return>
- <bootable>true</bootable>
- <cpuHotPlug>true</cpuHotPlug>
- <cpuHotUnPlug>false</cpuHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- <imageId>a984a5d3-9163-11e4-9d74-52540066fee9</imageId>
- <imageName>Ubuntu-14.04-LTS-server-2015-01-01</imageName>
- <imageSize>2048</imageSize>
- <imageType>HDD</imageType>
- <location>de/fra</location>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <osType>LINUX</osType>
- <public>true</public>
- <ramHotPlug>true</ramHotPlug>
- <ramHotUnPlug>false</ramHotUnPlug>
- <writeable>true</writeable>
- </return>
- <return>
- <bootable>true</bootable>
- <cpuHotPlug>true</cpuHotPlug>
- <cpuHotUnPlug>false</cpuHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- <imageId>5f3cac96-915f-11e4-9d74-52540066fee9</imageId>
- <imageName>Debian-jessie-prerelease-server-2015-01-01</imageName>
- <imageSize>2048</imageSize>
- <imageType>HDD</imageType>
- <location>us/lasdev</location>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <osType>LINUX</osType>
- <public>true</public>
- <ramHotPlug>true</ramHotPlug>
- <ramHotUnPlug>false</ramHotUnPlug>
- <writeable>true</writeable>
- </return>
- <return>
- <bootable>true</bootable>
- <cpuHotPlug>true</cpuHotPlug>
- <cpuHotUnPlug>false</cpuHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- <imageId>f4742db0-9160-11e4-9d74-52540066fee9</imageId>
- <imageName>Fedora-19-server-2015-01-01</imageName>
- <imageSize>2048</imageSize>
- <imageType>HDD</imageType>
- <location>us/lasdev</location>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <osType>LINUX</osType>
- <public>true</public>
- <ramHotPlug>true</ramHotPlug>
- <ramHotUnPlug>false</ramHotUnPlug>
- <writeable>true</writeable>
- </return>
- <return>
- <bootable>true</bootable>
- <cpuHotPlug>true</cpuHotPlug>
- <cpuHotUnPlug>false</cpuHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- <imageId>86902c18-9164-11e4-9d74-52540066fee9</imageId>
- <imageName>Ubuntu-12.04-LTS-server-2015-01-01</imageName>
- <imageSize>2048</imageSize>
- <imageType>HDD</imageType>
- <location>us/lasdev</location>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <osType>LINUX</osType>
- <public>true</public>
- <ramHotPlug>true</ramHotPlug>
- <ramHotUnPlug>false</ramHotUnPlug>
- <writeable>true</writeable>
- </return>
- <return>
- <bootable>true</bootable>
- <cpuHotPlug>true</cpuHotPlug>
- <cpuHotUnPlug>false</cpuHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- <imageId>3b48e3ff-9163-11e4-9d74-52540066fee9</imageId>
- <imageName>Ubuntu-14.04-LTS-server-2015-01-01</imageName>
- <imageSize>2048</imageSize>
- <imageType>HDD</imageType>
- <location>de/fkb</location>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <osType>LINUX</osType>
- <public>true</public>
- <ramHotPlug>true</ramHotPlug>
- <ramHotUnPlug>false</ramHotUnPlug>
- <writeable>true</writeable>
- </return>
- <return>
- <bootable>true</bootable>
- <cpuHotPlug>true</cpuHotPlug>
- <cpuHotUnPlug>false</cpuHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- <imageId>6ce17716-9164-11e4-9d74-52540066fee9</imageId>
- <imageName>Ubuntu-12.04-LTS-server-2015-01-01</imageName>
- <imageSize>2048</imageSize>
- <imageType>HDD</imageType>
- <location>us/las</location>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <osType>LINUX</osType>
- <public>true</public>
- <ramHotPlug>true</ramHotPlug>
- <ramHotUnPlug>false</ramHotUnPlug>
- <writeable>true</writeable>
- </return>
- </ns2:getAllImagesResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/ipblock/ipblock-addtonic.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/ipblock/ipblock-addtonic.xml b/profitbricks/src/test/resources/ipblock/ipblock-addtonic.xml
deleted file mode 100644
index 8496660..0000000
--- a/profitbricks/src/test/resources/ipblock/ipblock-addtonic.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:addPublicIpToNicResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>datacenter-version</dataCenterVersion>
- </return>
- </ns2:addPublicIpToNicResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/ipblock/ipblock-release.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/ipblock/ipblock-release.xml b/profitbricks/src/test/resources/ipblock/ipblock-release.xml
deleted file mode 100644
index d10e675..0000000
--- a/profitbricks/src/test/resources/ipblock/ipblock-release.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:releasePublicIpBlockResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- </return>
- </ns2:releasePublicIpBlockResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/ipblock/ipblock-removefromnic.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/ipblock/ipblock-removefromnic.xml b/profitbricks/src/test/resources/ipblock/ipblock-removefromnic.xml
deleted file mode 100644
index 8496660..0000000
--- a/profitbricks/src/test/resources/ipblock/ipblock-removefromnic.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:addPublicIpToNicResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>datacenter-version</dataCenterVersion>
- </return>
- </ns2:addPublicIpToNicResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/ipblock/ipblock-reserve.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/ipblock/ipblock-reserve.xml b/profitbricks/src/test/resources/ipblock/ipblock-reserve.xml
deleted file mode 100644
index 89d14f7..0000000
--- a/profitbricks/src/test/resources/ipblock/ipblock-reserve.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:reservePublicIpBlockResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- <blockId>block-id</blockId>
- <location>us/las</location>
- <ips>10.0.0.1</ips>
- </return>
- </ns2:reservePublicIpBlockResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/ipblock/ipblock.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/ipblock/ipblock.xml b/profitbricks/src/test/resources/ipblock/ipblock.xml
deleted file mode 100644
index 0b22915..0000000
--- a/profitbricks/src/test/resources/ipblock/ipblock.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getAllPublicIpBlocksResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <blockId>qwertyui-qwer-qwer-qwer-qwertyyuiiop</blockId>
- <location>us/las</location>
- <publicIps>
- <ip>10.0.0.2</ip>
- <nicId>nic-id</nicId>
- </publicIps>
- <publicIps>
- <ip>10.0.0.3</ip>
- </publicIps>
- </return>
- </ns2:getAllPublicIpBlocksResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/ipblock/ipblocks.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/ipblock/ipblocks.xml b/profitbricks/src/test/resources/ipblock/ipblocks.xml
deleted file mode 100644
index 44ea788..0000000
--- a/profitbricks/src/test/resources/ipblock/ipblocks.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getAllPublicIpBlocksResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <blockId>block-id-1</blockId>
- <location>us/las</location>
- <publicIps>
- <ip>10.0.0.2</ip>
- <nicId>nic-id-1</nicId>
- </publicIps>
- <publicIps>
- <ip>10.0.0.3</ip>
- <nicId>nic-id-2</nicId>
- </publicIps>
- </return>
- <return>
- <blockId>block-id-2</blockId>
- <location>us/las</location>
- <publicIps>
- <ip>10.0.0.4</ip>
- </publicIps>
- <publicIps>
- <ip>10.0.0.5</ip>
- <nicId>nic-id-4</nicId>
- </publicIps>
- </return>
- </ns2:getAllPublicIpBlocksResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 58b97c1..0000000
--- a/profitbricks/src/test/resources/loadbalancer/loadbalancer-create.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:createLoadBalancerResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>10</dataCenterVersion>
- <loadBalancerId>1234-1234-1234-1234</loadBalancerId>
- </return>
- </ns2:createLoadBalancerResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 29e24aa..0000000
--- a/profitbricks/src/test/resources/loadbalancer/loadbalancer-delete.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?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>123</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/93aff921/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
deleted file mode 100644
index b149be8..0000000
--- a/profitbricks/src/test/resources/loadbalancer/loadbalancer-deregister.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:deregisterServersOnLoadBalancerResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>10</dataCenterVersion>
- </return>
- </ns2:deregisterServersOnLoadBalancerResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index c338883..0000000
--- a/profitbricks/src/test/resources/loadbalancer/loadbalancer-register.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:registerServersOnLoadBalancerResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>4</dataCenterVersion>
- <loadBalancerId>load-balancer-id</loadBalancerId>
- <lanId>1</lanId>
- <balancedServers>
- <activate>true</activate>
- <balancedNicId>balanced-nic-id</balancedNicId>
- <serverId>server-id</serverId>
- <serverName>server-name</serverName>
- </balancedServers>
- </return>
- </ns2:registerServersOnLoadBalancerResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 0da544d..0000000
--- a/profitbricks/src/test/resources/loadbalancer/loadbalancer-update.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:updateLoadBalancerResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>10</dataCenterVersion>
- </return>
- </ns2:updateLoadBalancerResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 6388113..0000000
--- a/profitbricks/src/test/resources/loadbalancer/loadbalancer.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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>4</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>2</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/93aff921/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
deleted file mode 100644
index afe2573..0000000
--- a/profitbricks/src/test/resources/loadbalancer/loadbalancers.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?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>4</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>1</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>4</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>2</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/93aff921/profitbricks/src/test/resources/logback-test.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/logback-test.xml b/profitbricks/src/test/resources/logback-test.xml
deleted file mode 100644
index 902e5cd..0000000
--- a/profitbricks/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-<configuration scan="false">
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>%m%n</pattern>
- </encoder>
- </appender>
-
- <appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <file>target/test-data/jclouds.log</file>
-
- <encoder>
- <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
- </encoder>
- </appender>
-
- <appender name="WIREFILE" class="ch.qos.logback.core.FileAppender">
- <file>target/test-data/jclouds-wire.log</file>
-
- <encoder>
- <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
- </encoder>
- </appender>
-
- <appender name="COMPUTEFILE" class="ch.qos.logback.core.FileAppender">
- <file>target/test-data/jclouds-compute.log</file>
-
- <encoder>
- <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
- </encoder>
- </appender>
-
- <appender name="SSHFILE" class="ch.qos.logback.core.FileAppender">
- <file>target/test-data/jclouds-ssh.log</file>
-
- <encoder>
- <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
- </encoder>
- </appender>
-
- <root>
- <level value="info" />
- </root>
-
- <logger name="org.jclouds">
- <level value="DEBUG" />
- <appender-ref ref="FILE" />
- </logger>
-
- <logger name="jclouds.compute">
- <level value="DEBUG" />
- <appender-ref ref="COMPUTEFILE" />
- </logger>
-
- <logger name="jclouds.wire">
- <level value="DEBUG" />
- <appender-ref ref="WIREFILE" />
- </logger>
-
- <logger name="jclouds.headers">
- <level value="DEBUG" />
- <appender-ref ref="WIREFILE" />
- </logger>
-
- <logger name="jclouds.ssh">
- <level value="DEBUG" />
- <appender-ref ref="SSHFILE" />
- </logger>
-
- <logger name="net.schmizz">
- <level value="DEBUG" />
- <appender-ref ref="SSHFILE" />
- </logger>
-</configuration>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/maintenance-503.html
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/maintenance-503.html b/profitbricks/src/test/resources/maintenance-503.html
deleted file mode 100644
index bbc1b1f..0000000
--- a/profitbricks/src/test/resources/maintenance-503.html
+++ /dev/null
@@ -1,67 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta lang="en" http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>Profitbricks | Maintenance</title>
- <link rel="stylesheet" type="text/css" href="css/style.css" />
- <link rel="stylesheet" type="text/css" href="css/content.css" />
- <link rel="stylesheet" type="text/css" href="css/recent_additions.css" />
- <link rel="shortcut icon" href="https://my.profitbricks.com/errorpages/favicon.ico" type="image/x-icon" />
- </head>
-
- <body>
- <div class="head1 h_bg"></div>
- <div class="head2 h_bg"></div>
- <div class="head3 h_bg"></div>
-
- <div id="wrapper">
- <div class="wrapper_inner">
-
- <div id="header">
- <a id="logo" href="#"><img alt="Profitbricks" src="img/logo.png" /></a>
- </div>
-
- <div id="main">
- <div id="right" style="min-height: 550px;">
- <div class="article msg">
- <h1>Maintenance</h1>
- <img width="49" height="49" title="" alt="message error" src="Profitbricks%20%7C%20Maintenance_files/msg_error.png" class="msg_sign" style="margin: 10px;" />
- <div class="container" style="margin:20px 80px !important;">
- <div class="bigmargin">
- <h2>Dear ProfitBricks users,</h2>
- <p>actually we are carrying out maintenance work right now.</p>
- <p>For urgent matters please contact:<br /><a href="mailto:support@profitbricks.com">support@profitbricks.com</a>.</p>
- <br />
- <p>We ask for your understanding and your patience.</p>
- <p>Your ProfitBricks Team</p>
- </div>
-
- <div class="bigmargin">
- <h2>Sehr geehrte(r) ProfitBricks Nutzerin/Nutzer,</h2>
- <p>zur Zeit führen wir Wartungsarbeiten durch.</p>
- <p>Bei dringenden Angelegenheiten wenden Sie sich bitte an:<br />
- <a href="mailto:support@profitbricks.com">support@profitbricks.com</a>
- </p>
- <br />
- <p>Wir bitten Sie um Ihr Verständnis und um etwas Geduld.</p>
- <p>Ihr ProfitBricks Team</p>
- </div>
-
- </div>
- </div>
- </div>
- <br class="clear" />
- </div>
-
- </div>
- </div>
-
- <div id="footer">
- <div class="bottom">
- <div class="inner">
- </div>
- </div>
- </div>
-
- </body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/nic/nic-create.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/nic/nic-create.xml b/profitbricks/src/test/resources/nic/nic-create.xml
deleted file mode 100644
index 613313b..0000000
--- a/profitbricks/src/test/resources/nic/nic-create.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:createNicReturn xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>1</dataCenterVersion>
- <nicId>nic-id</nicId>
- </return>
- </ns2:createNicReturn>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/nic/nic-delete.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/nic/nic-delete.xml b/profitbricks/src/test/resources/nic/nic-delete.xml
deleted file mode 100644
index 281bd09..0000000
--- a/profitbricks/src/test/resources/nic/nic-delete.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:deleteNicResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>datacenter-version</dataCenterVersion>
- </return>
- </ns2:deleteNicResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/nic/nic-internetaccess.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/nic/nic-internetaccess.xml b/profitbricks/src/test/resources/nic/nic-internetaccess.xml
deleted file mode 100644
index 3468ee4..0000000
--- a/profitbricks/src/test/resources/nic/nic-internetaccess.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:setInternetAccessResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>8</dataCenterVersion>
- </return>
- </ns2:setInternetAccessResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/nic/nic-update.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/nic/nic-update.xml b/profitbricks/src/test/resources/nic/nic-update.xml
deleted file mode 100644
index 70ce539..0000000
--- a/profitbricks/src/test/resources/nic/nic-update.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:updateNicResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>2</dataCenterVersion>
- </return>
- </ns2:updateNicResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/nic/nic.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/nic/nic.xml b/profitbricks/src/test/resources/nic/nic.xml
deleted file mode 100644
index e460384..0000000
--- a/profitbricks/src/test/resources/nic/nic.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getNicResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <nicId>12345678-abcd-efgh-ijkl-987654321000</nicId>
- <dataCenterId>0</dataCenterId>
- <dataCenterVersion>1</dataCenterVersion>
- <lanId>1</lanId>
- <nicName>name</nicName>
- <internetAccess>true</internetAccess>
- <serverId>server-id</serverId>
- <ips>192.168.0.1</ips>
- <macAddress>aa:bb:cc:dd:ee:ff</macAddress>
- <firewall>
- <active>true</active>
- <firewallId>firewall-id</firewallId>
- <nicId>nic-id</nicId>
- <provisioningState>AVAILABLE</provisioningState>
- </firewall>
- <dhcpActive>true</dhcpActive>
- <gatewayIp>10.0.0.1</gatewayIp>
- <provisioningState>AVAILABLE</provisioningState>
- </return>
- </ns2:getNicResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/nic/nics.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/nic/nics.xml b/profitbricks/src/test/resources/nic/nics.xml
deleted file mode 100644
index 89b92ea..0000000
--- a/profitbricks/src/test/resources/nic/nics.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getAllNicResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>12</dataCenterVersion>
- <nicId>nic-id</nicId>
- <nicName>nic-name</nicName>
- <lanId>1</lanId>
- <internetAccess>true</internetAccess>
- <serverId>server-id</serverId>
- <ips>192.168.0.1</ips>
- <macAddress>aa:bb:cc:dd:ee:f1</macAddress>
- <firewall>
- <active>true</active>
- <firewallId>firewall-id</firewallId>
- <nicId>nic-id</nicId>
- <provisioningState>AVAILABLE</provisioningState>
- </firewall>
- <dhcpActive>true</dhcpActive>
- <gatewayIp>192.168.0.0</gatewayIp>
- <provisioningState>AVAILABLE</provisioningState>
- </return>
- <return>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>21</dataCenterVersion>
- <nicId>nic-id2</nicId>
- <nicName>nick</nicName>
- <lanId>1</lanId>
- <internetAccess>false</internetAccess>
- <serverId>server-id</serverId>
- <ips>192.168.0.2</ips>
- <ips>192.168.0.3</ips>
- <ips>192.168.0.4</ips>
- <macAddress>aa:bb:cc:dd:ee:f2</macAddress>
- <firewall>
- <active>false</active>
- <firewallId>firewall-id2</firewallId>
- <nicId>nic-id</nicId>
- <provisioningState>AVAILABLE</provisioningState>
- </firewall>
- <dhcpActive>false</dhcpActive>
- <gatewayIp>192.168.0.0</gatewayIp>
- <provisioningState>AVAILABLE</provisioningState>
- </return>
- </ns2:getAllNicResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/server/server-create.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/server/server-create.xml b/profitbricks/src/test/resources/server/server-create.xml
deleted file mode 100644
index b0392d6..0000000
--- a/profitbricks/src/test/resources/server/server-create.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.api.profitbricks.com/">
- <soapenv:Header/>
- <soapenv:Body>
- <ws:createServerReturn>
- <return>
- <requestId>102457</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>2</dataCenterVersion>
- <serverId>qwertyui-qwer-qwer-qwer-qwertyyuiiop</serverId>
- </return>
- </ws:createServerReturn>
- </soapenv:Body>
-</soapenv:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/server/server-delete.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/server/server-delete.xml b/profitbricks/src/test/resources/server/server-delete.xml
deleted file mode 100644
index 1b18bd8..0000000
--- a/profitbricks/src/test/resources/server/server-delete.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.api.profitbricks.com/">
- <soapenv:Header/>
- <soapenv:Body>
- <ws:deleteServerResponse>
- <return>
- <requestId>102459</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>4</dataCenterVersion>
- </return>
- </ws:deleteServerResponse>
- </soapenv:Body>
-</soapenv:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/server/server-reset.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/server/server-reset.xml b/profitbricks/src/test/resources/server/server-reset.xml
deleted file mode 100644
index db8d498..0000000
--- a/profitbricks/src/test/resources/server/server-reset.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.api.profitbricks.com/">
- <soapenv:Header/>
- <soapenv:Body>
- <ws:resetServerResponse>
- <return>
- <requestId>123456</requestId>
- </return>
- </ws:resetServerResponse>
- </soapenv:Body>
-</soapenv:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/server/server-start.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/server/server-start.xml b/profitbricks/src/test/resources/server/server-start.xml
deleted file mode 100644
index a34ce84..0000000
--- a/profitbricks/src/test/resources/server/server-start.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.api.profitbricks.com/">
- <soapenv:Header/>
- <soapenv:Body>
- <ws:startServerResponse>
- <return>
- <requestId>123456</requestId>
- </return>
- </ws:startServerResponse>
- </soapenv:Body>
-</soapenv:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/server/server-state-inprocess.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/server/server-state-inprocess.xml b/profitbricks/src/test/resources/server/server-state-inprocess.xml
deleted file mode 100644
index 122191a..0000000
--- a/profitbricks/src/test/resources/server/server-state-inprocess.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getServerResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>16577212</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>22</dataCenterVersion>
- <serverId>qwertyui-qwer-qwer-qwer-qwertyyuiiop</serverId>
- <cores>1</cores>
- <ram>512</ram>
- <internetAccess>false</internetAccess>
- <provisioningState>INPROCESS</provisioningState>
- <virtualMachineState>NOSTATE</virtualMachineState>
- <creationTime>2015-01-29T00:37:49.096Z</creationTime>
- <lastModificationTime>2015-01-29T00:37:49.096Z</lastModificationTime>
- <osType>UNKNOWN</osType>
- <availabilityZone>AUTO</availabilityZone>
- <cpuHotPlug>false</cpuHotPlug>
- <ramHotPlug>false</ramHotPlug>
- <nicHotPlug>false</nicHotPlug>
- <nicHotUnPlug>false</nicHotUnPlug>
- <discVirtioHotPlug>false</discVirtioHotPlug>
- <discVirtioHotUnPlug>false</discVirtioHotUnPlug>
- </return>
- </ns2:getServerResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/server/server-stop.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/server/server-stop.xml b/profitbricks/src/test/resources/server/server-stop.xml
deleted file mode 100644
index 4f5bce4..0000000
--- a/profitbricks/src/test/resources/server/server-stop.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.api.profitbricks.com/">
- <soapenv:Header/>
- <soapenv:Body>
- <ws:stopServerResponse>
- <return>
- <requestId>123456</requestId>
- </return>
- </ws:stopServerResponse>
- </soapenv:Body>
-</soapenv:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/server/server-update.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/server/server-update.xml b/profitbricks/src/test/resources/server/server-update.xml
deleted file mode 100644
index fb95440..0000000
--- a/profitbricks/src/test/resources/server/server-update.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.api.profitbricks.com/">
- <soapenv:Header/>
- <soapenv:Body>
- <ws:updateServerResponse>
- <return>
- <requestId>102458</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>3</dataCenterVersion>
- </return>
- </ws:updateServerResponse>
- </soapenv:Body>
-</soapenv:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index c78721f..0000000
--- a/profitbricks/src/test/resources/server/server.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getServerResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>16366014</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>10</dataCenterVersion>
- <serverId>qwertyui-qwer-qwer-qwer-qwertyyuiiop</serverId>
- <serverName>facebook-node</serverName>
- <cores>4</cores>
- <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>
- <deviceNumber>1</deviceNumber>
- <size>40</size>
- <storageId>qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh</storageId>
- <storageName>facebook-storage</storageName>
- </connectedStorages>
- <nics>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>10</dataCenterVersion>
- <nicId>qwqwqwqw-wewe-erer-rtrt-tytytytytyty</nicId>
- <lanId>1</lanId>
- <internetAccess>true</internetAccess>
- <serverId>qwertyui-qwer-qwer-qwer-qwertyyuiiop</serverId>
- <ips>173.252.120.6</ips>
- <macAddress>02:01:09:cd:f0:b0</macAddress>
- <firewall>
- <active>false</active>
- <firewallId>wqwqwqwq-ewew-rere-trtr-ytytytytytyt</firewallId>
- <nicId>qwqwqwqw-wewe-erer-rtrt-tytytytytyty</nicId>
- <provisioningState>AVAILABLE</provisioningState>
- </firewall>
- <dhcpActive>true</dhcpActive>
- <gatewayIp>173.252.120.1</gatewayIp>
- <provisioningState>AVAILABLE</provisioningState>
- </nics>
- <provisioningState>AVAILABLE</provisioningState>
- <virtualMachineState>RUNNING</virtualMachineState>
- <creationTime>2014-12-04T07:09:23.138Z</creationTime>
- <lastModificationTime>2014-12-12T03:08:35.629Z</lastModificationTime>
- <osType>LINUX</osType>
- <availabilityZone>AUTO</availabilityZone>
- <cpuHotPlug>true</cpuHotPlug>
- <ramHotPlug>true</ramHotPlug>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- </return>
- </ns2:getServerResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index d38bc67..0000000
--- a/profitbricks/src/test/resources/server/servers.xml
+++ /dev/null
@@ -1,109 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getAllServersResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>10</dataCenterVersion>
- <serverId>qwertyui-qwer-qwer-qwer-qwertyyuiiop</serverId>
- <serverName>facebook-node</serverName>
- <cores>4</cores>
- <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>
- <deviceNumber>1</deviceNumber>
- <size>40</size>
- <storageId>qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh</storageId>
- <storageName>facebook-storage</storageName>
- </connectedStorages>
- <nics>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>10</dataCenterVersion>
- <nicId>qwqwqwqw-wewe-erer-rtrt-tytytytytyty</nicId>
- <lanId>1</lanId>
- <internetAccess>true</internetAccess>
- <serverId>qwertyui-qwer-qwer-qwer-qwertyyuiiop</serverId>
- <ips>173.252.120.6</ips>
- <macAddress>02:01:09:cd:f0:b0</macAddress>
- <firewall>
- <active>false</active>
- <firewallId>wqwqwqwq-ewew-rere-trtr-ytytytytytyt</firewallId>
- <nicId>qwqwqwqw-wewe-erer-rtrt-tytytytytyty</nicId>
- <provisioningState>AVAILABLE</provisioningState>
- </firewall>
- <dhcpActive>true</dhcpActive>
- <gatewayIp>173.252.120.1</gatewayIp>
- <provisioningState>AVAILABLE</provisioningState>
- </nics>
- <provisioningState>AVAILABLE</provisioningState>
- <virtualMachineState>RUNNING</virtualMachineState>
- <creationTime>2014-12-04T07:09:23.138Z</creationTime>
- <lastModificationTime>2014-12-12T03:08:35.629Z</lastModificationTime>
- <osType>LINUX</osType>
- <availabilityZone>AUTO</availabilityZone>
- <cpuHotPlug>true</cpuHotPlug>
- <ramHotPlug>true</ramHotPlug>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- </return>
- <return>
- <dataCenterId>qqqqqqqq-wwww-rrrr-tttt-yyyyyyyyyyyy</dataCenterId>
- <dataCenterVersion>238</dataCenterVersion>
- <serverId>asdfghjk-asdf-asdf-asdf-asdfghjklkjl</serverId>
- <serverName>google-node</serverName>
- <cores>1</cores>
- <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>
- <deviceNumber>1</deviceNumber>
- <size>5</size>
- <storageId>asfasfle-f23n-cu89-klfr-njkdsvwllkfa</storageId>
- <storageName>google-disk</storageName>
- </connectedStorages>
- <nics>
- <dataCenterId>qqqqqqqq-wwww-rrrr-tttt-yyyyyyyyyyyy</dataCenterId>
- <dataCenterVersion>238</dataCenterVersion>
- <nicId>mkl45h5e-sdgb-h6rh-235r-rfweshdfhreh</nicId>
- <lanId>3</lanId>
- <internetAccess>false</internetAccess>
- <serverId>asdfghjk-asdf-asdf-asdf-asdfghjklkjl</serverId>
- <ips>202.69.181.241</ips>
- <macAddress>02:01:9e:5e:35:1e</macAddress>
- <firewall>
- <active>false</active>
- <firewallId>cvvdsgbd-sdgj-eger-h56j-wet43gvsgeg4</firewallId>
- <nicId>mkl45h5e-sdgb-h6rh-235r-rfweshdfhreh</nicId>
- <provisioningState>INPROCESS</provisioningState>
- </firewall>
- <dhcpActive>false</dhcpActive>
- <gatewayIp>202.69.181.1</gatewayIp>
- <provisioningState>AVAILABLE</provisioningState>
- </nics>
- <provisioningState>AVAILABLE</provisioningState>
- <virtualMachineState>RUNNING</virtualMachineState>
- <creationTime>2014-11-12T07:01:00.441Z</creationTime>
- <lastModificationTime>2014-11-12T07:01:00.441Z</lastModificationTime>
- <osType>LINUX</osType>
- <availabilityZone>AUTO</availabilityZone>
- <cpuHotPlug>true</cpuHotPlug>
- <ramHotPlug>true</ramHotPlug>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- </return>
- </ns2:getAllServersResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/snapshot/snapshot-create.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/snapshot/snapshot-create.xml b/profitbricks/src/test/resources/snapshot/snapshot-create.xml
deleted file mode 100644
index 06a537d..0000000
--- a/profitbricks/src/test/resources/snapshot/snapshot-create.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:createSnapshotReturn xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>12345678</requestId>
- <snapshotId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</snapshotId>
- </return>
- </ns2:createSnapshotReturn>
- </S:Body>
-</S:Envelope>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/snapshot/snapshot-delete.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/snapshot/snapshot-delete.xml b/profitbricks/src/test/resources/snapshot/snapshot-delete.xml
deleted file mode 100644
index 45bf1a3..0000000
--- a/profitbricks/src/test/resources/snapshot/snapshot-delete.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:deleteSnapshotResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>123456789</requestId>
- </return>
- </ns2:deleteSnapshotResponse>
- </S:Body>
-</S:Envelope>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/snapshot/snapshot-rollback.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/snapshot/snapshot-rollback.xml b/profitbricks/src/test/resources/snapshot/snapshot-rollback.xml
deleted file mode 100644
index 661ce21..0000000
--- a/profitbricks/src/test/resources/snapshot/snapshot-rollback.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:rollbackSnapshotResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>1234567890</requestId>
- <dataCenterId>qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh</dataCenterId>
- <dataCenterVersion>1</dataCenterVersion>
- </return>
- </ns2:rollbackSnapshotResponse>
- </S:Body>
-</S:Envelope>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/snapshot/snapshot-state-inprocess.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/snapshot/snapshot-state-inprocess.xml b/profitbricks/src/test/resources/snapshot/snapshot-state-inprocess.xml
deleted file mode 100644
index 9f8acff..0000000
--- a/profitbricks/src/test/resources/snapshot/snapshot-state-inprocess.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getSnapshotResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <snapshotId>qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh</snapshotId>
- <description>description</description>
- <snapshotSize>1024</snapshotSize>
- <snapshotName>snapshot01</snapshotName>
- <provisioningState>INPROCESS</provisioningState>
- <bootable>true</bootable>
- <osType>LINUX</osType>
- <cpuHotPlug>true</cpuHotPlug>
- <cpuHotUnPlug>true</cpuHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- <ramHotPlug>true</ramHotPlug>
- <ramHotUnPlug>true</ramHotUnPlug>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <creationTimestamp>2015-01-26T07:09:23.138Z</creationTimestamp>
- <modificationTimestamp>2015-01-26T07:09:23.138Z</modificationTimestamp>
- <location>us/las</location>
- </return>
- </ns2:getSnapshotResponse>
- </S:Body>
-</S:Envelope>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/snapshot/snapshot-update.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/snapshot/snapshot-update.xml b/profitbricks/src/test/resources/snapshot/snapshot-update.xml
deleted file mode 100644
index 028cce0..0000000
--- a/profitbricks/src/test/resources/snapshot/snapshot-update.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:updateSnapshotResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>12345678</requestId>
- </return>
- </ns2:updateSnapshotResponse>
- </S:Body>
-</S:Envelope>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/snapshot/snapshot.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/snapshot/snapshot.xml b/profitbricks/src/test/resources/snapshot/snapshot.xml
deleted file mode 100644
index d406be1..0000000
--- a/profitbricks/src/test/resources/snapshot/snapshot.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getSnapshotResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <snapshotId>qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh</snapshotId>
- <description>description</description>
- <snapshotSize>1024</snapshotSize>
- <snapshotName>snapshot01</snapshotName>
- <provisioningState>AVAILABLE</provisioningState>
- <bootable>true</bootable>
- <osType>LINUX</osType>
- <cpuHotPlug>true</cpuHotPlug>
- <cpuHotUnPlug>true</cpuHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- <ramHotPlug>true</ramHotPlug>
- <ramHotUnPlug>true</ramHotUnPlug>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <creationTimestamp>2015-01-26T07:09:23.138Z</creationTimestamp>
- <modificationTimestamp>2015-01-26T07:09:23.138Z</modificationTimestamp>
- <location>us/las</location>
- </return>
- </ns2:getSnapshotResponse>
- </S:Body>
-</S:Envelope>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/snapshot/snapshots.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/snapshot/snapshots.xml b/profitbricks/src/test/resources/snapshot/snapshots.xml
deleted file mode 100644
index 1b3ab72..0000000
--- a/profitbricks/src/test/resources/snapshot/snapshots.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getAllSnapshotsResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <snapshotId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</snapshotId>
- <description>description</description>
- <snapshotSize>1024</snapshotSize>
- <snapshotName>snapshot01</snapshotName>
- <provisioningState>AVAILABLE</provisioningState>
- <bootable>true</bootable>
- <osType>LINUX</osType>
- <cpuHotPlug>true</cpuHotPlug>
- <cpuHotUnPlug>true</cpuHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- <ramHotPlug>true</ramHotPlug>
- <ramHotUnPlug>true</ramHotUnPlug>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <creationTimestamp>2015-01-26T07:09:23.138Z</creationTimestamp>
- <modificationTimestamp>2015-01-26T07:09:23.138Z</modificationTimestamp>
- <location>us/las</location>
- </return>
- <return>
- <snapshotId>qqqqqqqq-wwww-rrrr-tttt-yyyyyyyyyyyy</snapshotId>
- <description>description</description>
- <snapshotSize>1024</snapshotSize>
- <snapshotName>snapshot02</snapshotName>
- <provisioningState>AVAILABLE</provisioningState>
- <bootable>true</bootable>
- <osType>LINUX</osType>
- <cpuHotPlug>true</cpuHotPlug>
- <cpuHotUnPlug>true</cpuHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- <ramHotPlug>true</ramHotPlug>
- <ramHotUnPlug>true</ramHotUnPlug>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <creationTimestamp>2015-01-26T07:09:23.138Z</creationTimestamp>
- <modificationTimestamp>2015-01-26T07:09:23.138Z</modificationTimestamp>
- <location>us/las</location>
- </return>
- </ns2:getAllSnapshotsResponse>
- </S:Body>
-</S:Envelope>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/storage/storage-connect.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/storage/storage-connect.xml b/profitbricks/src/test/resources/storage/storage-connect.xml
deleted file mode 100644
index 79673e2..0000000
--- a/profitbricks/src/test/resources/storage/storage-connect.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.api.profitbricks.com/">
- <soapenv:Header/>
- <soapenv:Body>
- <ws:connectStorageToServerResponse>
- <return>
- <requestId>16463317</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>49</dataCenterVersion>
- </return>
- </ws:connectStorageToServerResponse>
- </soapenv:Body>
-</soapenv:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/storage/storage-create.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/storage/storage-create.xml b/profitbricks/src/test/resources/storage/storage-create.xml
deleted file mode 100644
index 3e1d1f3..0000000
--- a/profitbricks/src/test/resources/storage/storage-create.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.api.profitbricks.com/">
- <soapenv:Header/>
- <soapenv:Body>
- <ws:createStorageReturn>
- <return>
- <requestId>1234567</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>45</dataCenterVersion>
- <storageId>qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh</storageId>
- </return>
- </ws:createStorageReturn>
- </soapenv:Body>
-</soapenv:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/storage/storage-delete.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/storage/storage-delete.xml b/profitbricks/src/test/resources/storage/storage-delete.xml
deleted file mode 100644
index a973126..0000000
--- a/profitbricks/src/test/resources/storage/storage-delete.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.api.profitbricks.com/">
- <soapenv:Header/>
- <soapenv:Body>
- <ws:deleteStorageResponse>
- <return>
- <requestId>12345679</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>47</dataCenterVersion>
- </return>
- </ws:deleteStorageResponse>
- </soapenv:Body>
-</soapenv:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/storage/storage-disconnect.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/storage/storage-disconnect.xml b/profitbricks/src/test/resources/storage/storage-disconnect.xml
deleted file mode 100644
index 8726fe2..0000000
--- a/profitbricks/src/test/resources/storage/storage-disconnect.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.api.profitbricks.com/">
- <soapenv:Header/>
- <soapenv:Body>
- <ws:disconnectStorageFromServerResponse>
- <return>
- <requestId>16463318</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>50</dataCenterVersion>
- </return>
- </ws:disconnectStorageFromServerResponse>
- </soapenv:Body>
-</soapenv:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/storage/storage-state-inprocess.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/storage/storage-state-inprocess.xml b/profitbricks/src/test/resources/storage/storage-state-inprocess.xml
deleted file mode 100644
index 85c4717..0000000
--- a/profitbricks/src/test/resources/storage/storage-state-inprocess.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getStorageResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>16463316</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>49</dataCenterVersion>
- <storageId>qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh</storageId>
- <size>40</size>
- <storageName>hdd-1</storageName>
- <mountImage>
- <imageId>f0a59a5c-7940-11e4-8053-52540066fee9</imageId>
- <imageName>Ubuntu-14.04-LTS-server-2014-12-01</imageName>
- </mountImage>
- <serverIds>qwertyui-qwer-qwer-qwer-qwertyyuiiop</serverIds>
- <provisioningState>INPROCESS</provisioningState>
- <creationTime>2014-12-04T07:09:23.138Z</creationTime>
- <lastModificationTime>2014-12-12T03:14:48.316Z</lastModificationTime>
- </return>
- </ns2:getStorageResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/storage/storage-update.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/storage/storage-update.xml b/profitbricks/src/test/resources/storage/storage-update.xml
deleted file mode 100644
index ff71f32..0000000
--- a/profitbricks/src/test/resources/storage/storage-update.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.api.profitbricks.com/">
- <soapenv:Header/>
- <soapenv:Body>
- <ws:updateStorageResponse>
- <return>
- <requestId>1234568</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>46</dataCenterVersion>
- </return>
- </ws:updateStorageResponse>
- </soapenv:Body>
-</soapenv:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/storage/storage.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/storage/storage.xml b/profitbricks/src/test/resources/storage/storage.xml
deleted file mode 100644
index fe4dfc5..0000000
--- a/profitbricks/src/test/resources/storage/storage.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getStorageResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>16463316</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>49</dataCenterVersion>
- <storageId>qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh</storageId>
- <size>40</size>
- <storageName>hdd-1</storageName>
- <mountImage>
- <imageId>f0a59a5c-7940-11e4-8053-52540066fee9</imageId>
- <imageName>Ubuntu-14.04-LTS-server-2014-12-01</imageName>
- </mountImage>
- <serverIds>qwertyui-qwer-qwer-qwer-qwertyyuiiop</serverIds>
- <provisioningState>AVAILABLE</provisioningState>
- <creationTime>2014-12-04T07:09:23.138Z</creationTime>
- <lastModificationTime>2014-12-12T03:14:48.316Z</lastModificationTime>
- </return>
- </ns2:getStorageResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/storage/storages.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/storage/storages.xml b/profitbricks/src/test/resources/storage/storages.xml
deleted file mode 100644
index a732861..0000000
--- a/profitbricks/src/test/resources/storage/storages.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getAllStoragesResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>49</dataCenterVersion>
- <storageId>qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh</storageId>
- <size>40</size>
- <storageName>hdd-1</storageName>
- <mountImage>
- <imageId>f0a59a5c-7940-11e4-8053-52540066fee9</imageId>
- <imageName>Ubuntu-14.04-LTS-server-2014-12-01</imageName>
- </mountImage>
- <serverIds>qwertyui-qwer-qwer-qwer-qwertyyuiiop</serverIds>
- <provisioningState>AVAILABLE</provisioningState>
- <creationTime>2014-12-04T07:09:23.138Z</creationTime>
- <lastModificationTime>2014-12-12T03:14:48.316Z</lastModificationTime>
- </return>
- <return>
- <dataCenterId>qqqqqqqq-wwww-rrrr-tttt-yyyyyyyyyyyy</dataCenterId>
- <dataCenterVersion>238</dataCenterVersion>
- <storageId>asfasfle-f23n-cu89-klfr-njkdsvwllkfa</storageId>
- <size>100</size>
- <storageName>hdd-2</storageName>
- <mountImage>
- <imageId>f4742db0-9160-11e4-9d74-52540066fee9</imageId>
- <imageName>Fedora-19-server-2015-01-01</imageName>
- </mountImage>
- <serverIds>asdfghjk-asdf-asdf-asdf-asdfghjklkjl</serverIds>
- <provisioningState>INPROCESS</provisioningState>
- <creationTime>2014-11-04T07:09:23.138Z</creationTime>
- <lastModificationTime>2014-11-12T03:14:48.316Z</lastModificationTime>
- </return>
- </ns2:getAllStoragesResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
[09/11] jclouds-labs git commit: Remove ProfitBricks
Posted by de...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Drive.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Drive.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Drive.java
deleted file mode 100644
index c2efe09..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Drive.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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 org.jclouds.javax.annotation.Nullable;
-
-@AutoValue
-public abstract class Drive {
-
- public abstract static class Request {
-
- @AutoValue
- public abstract static class AddRomDriveToServerPayload {
-
- public abstract String serverId();
-
- public abstract String imageId();
-
- @Nullable
- public abstract String deviceNumber();
-
- public static Builder builder() {
- return new AutoValue_Drive_Request_AddRomDriveToServerPayload.Builder();
- }
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder serverId(String serverId);
-
- public abstract Builder imageId(String imageId);
-
- public abstract Builder deviceNumber(String deviceNumber);
-
- public abstract AddRomDriveToServerPayload build();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Firewall.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Firewall.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Firewall.java
deleted file mode 100644
index 78b30c1..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Firewall.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * 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 static org.jclouds.profitbricks.util.Preconditions.checkIcmp;
-import static org.jclouds.profitbricks.util.Preconditions.checkIp;
-import static org.jclouds.profitbricks.util.Preconditions.checkMacAddress;
-import static org.jclouds.profitbricks.util.Preconditions.checkPortRange;
-
-import java.util.List;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.auto.value.AutoValue;
-import com.google.common.base.Enums;
-import com.google.common.collect.ImmutableList;
-
-@AutoValue
-public abstract class Firewall {
-
- public enum Protocol {
-
- TCP, UDP, ICMP, ANY, UNRECOGNIZED;
-
- public static Protocol fromValue(String value) {
- return Enums.getIfPresent(Protocol.class, value).or(UNRECOGNIZED);
- }
- }
-
- @Nullable
- public abstract String id();
-
- @Nullable
- public abstract String nicId();
-
- @Nullable
- public abstract Boolean active();
-
- @Nullable
- public abstract ProvisioningState state();
-
- @Nullable
- public abstract List<Rule> rules();
-
- public static Builder builder() {
- return new AutoValue_Firewall.Builder()
- .rules(ImmutableList.<Rule>of());
- }
-
- public abstract Builder toBuilder();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder id(String id);
-
- public abstract Builder nicId(String nicId);
-
- public abstract Builder active(Boolean active);
-
- public abstract Builder state(ProvisioningState state);
-
- public abstract Builder rules(List<Rule> rules);
-
- abstract Firewall autoBuild();
-
- public Firewall build(){
- Firewall built = autoBuild();
-
- return built.toBuilder()
- .rules(ImmutableList.copyOf(built.rules()))
- .autoBuild();
- }
- }
-
- public static final class Request {
-
- public static AddRulePayload createAddRulePayload(String nicId, List<Rule> rules) {
- return new AutoValue_Firewall_Request_AddRulePayload(nicId, ImmutableList.copyOf(rules));
- }
-
- @AutoValue
- public abstract static class AddRulePayload {
-
- public abstract String nicId();
-
- public abstract List<Rule> rules();
-
- }
- }
-
- @AutoValue
- public abstract static class Rule {
-
- @Nullable
- public abstract String id();
-
- @Nullable
- public abstract String name();
-
- @Nullable
- public abstract Integer portRangeEnd();
-
- @Nullable
- public abstract Integer portRangeStart();
-
- @Nullable
- public abstract Protocol protocol();
-
- @Nullable
- public abstract String sourceIp();
-
- @Nullable
- public abstract String sourceMac();
-
- @Nullable
- public abstract String targetIp();
-
- @Nullable
- public abstract Integer icmpCode();
-
- @Nullable
- public abstract Integer icmpType();
-
- public static Builder builder() {
- return new AutoValue_Firewall_Rule.Builder()
- .protocol(Protocol.ANY);
- }
-
- public Builder toBuilder() {
- return new AutoValue_Firewall_Rule.Builder(this);
- }
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder id(String id);
-
- public abstract Builder name(String name);
-
- public abstract Builder portRangeEnd(Integer portRangeEnd);
-
- public abstract Builder portRangeStart(Integer portRangeStart);
-
- public abstract Builder protocol(Protocol protocol);
-
- public abstract Builder sourceIp(String sourceIp);
-
- public abstract Builder sourceMac(String sourceMac);
-
- public abstract Builder targetIp(String targetIp);
-
- public abstract Builder icmpCode(Integer icmpCode);
-
- public abstract Builder icmpType(Integer icmpType);
-
- abstract Rule autoBuild();
-
- public Rule build() {
- Rule rule = autoBuild();
- if (rule.sourceIp() != null)
- checkIp(rule.sourceIp());
- if (rule.targetIp() != null)
- checkIp(rule.targetIp());
- if (rule.sourceMac() != null)
- checkMacAddress(rule.sourceMac());
- checkPortRange(rule.portRangeStart(), rule.portRangeEnd(), rule.protocol());
- checkIcmp(rule.icmpType(), rule.icmpCode(), rule.protocol());
-
- return rule;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Image.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Image.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Image.java
deleted file mode 100644
index 383a744..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Image.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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 org.jclouds.javax.annotation.Nullable;
-
-@AutoValue
-public abstract class Image implements Provisionable {
-
- public enum Type {
-
- HDD, CDROM, UNRECOGNIZED;
-
- public static Type fromValue(String v) {
- return Enums.getIfPresent(Type.class, v).or(UNRECOGNIZED);
- }
- }
-
- public abstract String id();
-
- public abstract String name();
-
- public abstract float size(); // MB
-
- public abstract Location location();
-
- public abstract OsType osType();
-
- public abstract Type type();
-
- @Nullable
- public abstract Boolean isPublic();
-
- @Nullable
- public abstract Boolean isWriteable();
-
- @Nullable
- public abstract Boolean isBootable();
-
- @Nullable
- public abstract Boolean isCpuHotPlug();
-
- @Nullable
- public abstract Boolean isCpuHotUnPlug();
-
- @Nullable
- public abstract Boolean isRamHotPlug();
-
- @Nullable
- public abstract Boolean isRamHotUnPlug();
-
- @Nullable
- public abstract Boolean isNicHotPlug();
-
- @Nullable
- public abstract Boolean isNicHotUnPlug();
-
- @Nullable
- public abstract Boolean isDiscVirtioHotPlug();
-
- @Nullable
- public abstract Boolean isDiscVirtioHotUnPlug();
-
- public static Builder builder() {
- return new AutoValue_Image.Builder();
- }
-
- public abstract Builder toBuilder();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder id(String id);
-
- public abstract Builder name(String name);
-
- public abstract Builder size(float size);
-
- public abstract Builder location(Location location);
-
- public abstract Builder osType(OsType osType);
-
- public abstract Builder type(Type type);
-
- public abstract Builder isPublic(Boolean isPublic);
-
- public abstract Builder isWriteable(Boolean isWriteable);
-
- public abstract Builder isBootable(Boolean isBootable);
-
- public abstract Builder isCpuHotPlug(Boolean isCpuHotPlug);
-
- public abstract Builder isCpuHotUnPlug(Boolean isCpuHotUnPlug);
-
- public abstract Builder isRamHotPlug(Boolean isRamHotPlug);
-
- public abstract Builder isRamHotUnPlug(Boolean isRamHotUnPlug);
-
- public abstract Builder isNicHotPlug(Boolean isNicHotPlug);
-
- public abstract Builder isNicHotUnPlug(Boolean isNicHotUnPlug);
-
- public abstract Builder isDiscVirtioHotPlug(Boolean isDiscVirtioHotPlug);
-
- public abstract Builder isDiscVirtioHotUnPlug(Boolean isDiscVirtioHotUnPlug);
-
- public abstract Image build();
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/domain/IpBlock.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/IpBlock.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/IpBlock.java
deleted file mode 100644
index cc2c999..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/IpBlock.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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 static org.jclouds.profitbricks.util.Preconditions.checkIp;
-import static org.jclouds.profitbricks.util.Preconditions.checkIps;
-
-import com.google.auto.value.AutoValue;
-import com.google.common.collect.ImmutableList;
-
-import java.util.List;
-
-import org.jclouds.javax.annotation.Nullable;
-
-@AutoValue
-public abstract class IpBlock {
-
- public abstract String id();
-
- public abstract Location location();
-
- public abstract List<PublicIp> publicIps();
-
- @Nullable
- public abstract List<String> ips();
-
- public static Builder builder() {
- return new AutoValue_IpBlock.Builder()
- .publicIps(ImmutableList.<PublicIp>of())
- .ips(ImmutableList.<String>of());
- }
-
- public abstract Builder toBuilder();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder id(String id);
-
- public abstract Builder location(Location location);
-
- public abstract Builder publicIps(List<PublicIp> publicIps);
-
- public abstract Builder ips(List<String> ips);
-
- abstract IpBlock autoBuild();
-
- public IpBlock build() {
- IpBlock ipBlock = autoBuild();
- checkIps(ipBlock.ips());
-
- return ipBlock.toBuilder()
- .publicIps(ImmutableList.copyOf(ipBlock.publicIps()))
- .ips(ImmutableList.copyOf(ipBlock.ips()))
- .autoBuild();
- }
- }
-
- @AutoValue
- public abstract static class PublicIp {
-
- public abstract String ip();
-
- @Nullable
- public abstract String nicId();
-
- public static Builder builder() {
- return new AutoValue_IpBlock_PublicIp.Builder();
- }
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder ip(String ip);
-
- public abstract Builder nicId(String nicId);
-
- abstract PublicIp autoBuild();
-
- public PublicIp build() {
- PublicIp publicIp = autoBuild();
- checkIp(publicIp.ip());
-
- return publicIp;
- }
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 863890b..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/LoadBalancer.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * 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 static org.jclouds.profitbricks.util.Preconditions.checkIp;
-import static org.jclouds.profitbricks.util.Preconditions.checkLanId;
-
-import java.util.Date;
-import java.util.List;
-
-import com.google.auto.value.AutoValue;
-import com.google.common.base.Enums;
-import com.google.common.collect.ImmutableList;
-
-import org.jclouds.javax.annotation.Nullable;
-
-@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 algorithm();
-
- @Nullable
- public abstract DataCenter dataCenter();
-
- @Nullable
- public abstract Boolean internetAccess();
-
- @Nullable
- public abstract String ip();
-
- @Nullable
- public abstract Integer 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 Builder builder() {
- return new AutoValue_LoadBalancer.Builder()
- .balancedServers(ImmutableList.<Server>of())
- .firewalls(ImmutableList.<Firewall>of());
- }
-
- public abstract Builder toBuilder();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder id(String id);
-
- public abstract Builder name(String name);
-
- public abstract Builder algorithm(Algorithm algorithm);
-
- public abstract Builder dataCenter(DataCenter dataCenter);
-
- public abstract Builder internetAccess(Boolean internetAccess);
-
- public abstract Builder ip(String ip);
-
- public abstract Builder lanId(Integer lanId);
-
- public abstract Builder creationTime(Date creationTime);
-
- public abstract Builder state(ProvisioningState state);
-
- public abstract Builder lastModificationTime(Date lastModificationTime);
-
- public abstract Builder balancedServers(List<Server> balancedServers);
-
- public abstract Builder firewalls(List<Firewall> firewalls);
-
- abstract LoadBalancer autoBuild();
-
- public LoadBalancer build() {
- LoadBalancer loadBalancer = autoBuild();
- if (loadBalancer.ip() != null)
- checkIp(loadBalancer.ip());
- if (loadBalancer.lanId() != null)
- checkLanId(loadBalancer.lanId());
-
- return loadBalancer.toBuilder()
- .balancedServers(ImmutableList.copyOf(loadBalancer.balancedServers()))
- .firewalls(ImmutableList.copyOf(loadBalancer.firewalls()))
- .autoBuild();
- }
- }
-
- public static final class Request {
-
- public static CreatePayload.Builder creatingBuilder() {
- return new AutoValue_LoadBalancer_Request_CreatePayload.Builder()
- .serverIds(ImmutableList.<String>of())
- .algorithm(Algorithm.ROUND_ROBIN);
- }
-
- public static UpdatePayload.Builder updatingBuilder() {
- return new AutoValue_LoadBalancer_Request_UpdatePayload.Builder()
- .algorithm(Algorithm.ROUND_ROBIN);
- }
-
- public static RegisterPayload createRegisteringPaylod(String loadBalancerId, List<String> serverIds) {
- return new AutoValue_LoadBalancer_Request_RegisterPayload(loadBalancerId, ImmutableList.copyOf(serverIds));
- }
-
- public static DeregisterPayload createDeregisteringPayload(String loadBalancerId, List<String> serverIds) {
- return new AutoValue_LoadBalancer_Request_DeregisterPayload(loadBalancerId, ImmutableList.copyOf(serverIds));
- }
-
- @AutoValue
- public abstract static class CreatePayload {
-
- public abstract String dataCenterId();
-
- @Nullable
- public abstract String name();
-
- public abstract Algorithm algorithm();
-
- @Nullable
- public abstract String ip();
-
- @Nullable
- public abstract Integer lanId();
-
- public abstract List<String> serverIds();
-
- public abstract Builder toBuilder();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder dataCenterId(String dataCenterId);
-
- public abstract Builder name(String name);
-
- public abstract Builder algorithm(Algorithm algorithm);
-
- public abstract Builder ip(String ip);
-
- public abstract Builder lanId(Integer lanId);
-
- public abstract Builder serverIds(List<String> serverIds);
-
- abstract CreatePayload autoBuild();
-
- public CreatePayload build() {
- CreatePayload payload = autoBuild();
- if (payload.ip() != null)
- checkIp(payload.ip());
- if (payload.lanId() != null)
- checkLanId(payload.lanId());
-
- return payload.toBuilder()
- .serverIds(ImmutableList.copyOf(payload.serverIds()))
- .autoBuild();
- }
- }
- }
-
- @AutoValue
- public abstract static class RegisterPayload {
-
- public abstract String id();
-
- public abstract List<String> serverIds();
-
- }
-
- @AutoValue
- public abstract static class DeregisterPayload {
-
- public abstract String id();
-
- public abstract List<String> serverIds();
-
- }
-
- @AutoValue
- public abstract static class UpdatePayload {
-
- public abstract String id();
-
- @Nullable
- public abstract String name();
-
- public abstract Algorithm algorithm();
-
- @Nullable
- public abstract String ip();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder id(String id);
-
- public abstract Builder name(String name);
-
- public abstract Builder algorithm(Algorithm algorithm);
-
- public abstract Builder ip(String ip);
-
- abstract UpdatePayload autoBuild();
-
- public UpdatePayload build() {
- UpdatePayload payload = autoBuild();
- if (payload.ip() != null)
- checkIp(payload.ip());
-
- return payload;
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Location.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Location.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Location.java
deleted file mode 100644
index 834fa86..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Location.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.common.base.Enums;
-
-public enum Location {
-
- DE_FKB("de/fkb", "Germany, Karlsruhe"),
- DE_FRA("de/fra", "Germany, Frankfurt (M)"),
- US_LAS("us/las", "USA, Las Vegas"),
- US_LASDEV("us/lasdev", "USA Developer cluster"),
- UNRECOGNIZED("unrecognized", "Unrecognized location");
-
- private final String id;
- private final String description;
-
- Location(String id, String description) {
- this.id = id;
- this.description = description;
- }
-
- public String getId() {
- return id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public static Location fromValue(String v) {
- return Enums.getIfPresent(Location.class, v).or(UNRECOGNIZED);
- }
-
- public static Location fromId(String id) {
- for (Location location : values())
- if (location.id.equals(id))
- return location;
- return UNRECOGNIZED;
- }
-
- @Override
- public String toString() {
- return id;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Nic.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Nic.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Nic.java
deleted file mode 100644
index a7e421d..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Nic.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * 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 static org.jclouds.profitbricks.util.Preconditions.checkIp;
-import static org.jclouds.profitbricks.util.Preconditions.checkIps;
-import static org.jclouds.profitbricks.util.Preconditions.checkLanId;
-import static org.jclouds.profitbricks.util.Preconditions.checkMacAddress;
-
-import java.util.List;
-
-import com.google.auto.value.AutoValue;
-import com.google.common.collect.ImmutableList;
-
-import org.jclouds.javax.annotation.Nullable;
-
-@AutoValue
-public abstract class Nic {
-
- @Nullable
- public abstract String id();
-
- @Nullable
- public abstract String name();
-
- @Nullable
- public abstract String dataCenterId();
-
- @Nullable
- public abstract Integer lanId();
-
- @Nullable
- public abstract Boolean internetAccess();
-
- @Nullable
- public abstract String serverId();
-
- @Nullable
- public abstract List<String> ips();
-
- @Nullable
- public abstract String macAddress();
-
- @Nullable
- public abstract Firewall firewall();
-
- @Nullable
- public abstract Boolean dhcpActive();
-
- @Nullable
- public abstract String gatewayIp();
-
- @Nullable
- public abstract ProvisioningState state();
-
- public static Builder builder() {
- return new AutoValue_Nic.Builder()
- .ips(ImmutableList.<String>of());
- }
-
- public abstract Builder toBuilder();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder id(String id);
-
- public abstract Builder name(String name);
-
- public abstract Builder dataCenterId(String dataCenterId);
-
- public abstract Builder lanId(Integer lanId);
-
- public abstract Builder internetAccess(Boolean internetAccess);
-
- public abstract Builder serverId(String serverId);
-
- public abstract Builder ips(List<String> ips);
-
- public abstract Builder macAddress(String macAddress);
-
- public abstract Builder firewall(Firewall firewall);
-
- public abstract Builder dhcpActive(Boolean dhcpActive);
-
- public abstract Builder gatewayIp(String gatewayIp);
-
- public abstract Builder state(ProvisioningState state);
-
- abstract Nic autoBuild();
-
- public Nic build() {
- Nic nic = autoBuild();
- if (nic.ips() != null)
- checkIps(nic.ips());
- if (nic.gatewayIp() != null)
- checkIp(nic.gatewayIp());
- if (nic.lanId() != null)
- checkLanId(nic.lanId());
- if (nic.macAddress() != null)
- checkMacAddress(nic.macAddress());
-
- return nic.toBuilder()
- .ips(ImmutableList.copyOf(nic.ips()))
- .autoBuild();
- }
-
- }
-
- public static final class Request {
-
- public static CreatePayload.Builder creatingBuilder() {
- return new AutoValue_Nic_Request_CreatePayload.Builder();
- }
-
- public static UpdatePayload.Builder updatingBuilder() {
- return new AutoValue_Nic_Request_UpdatePayload.Builder();
- }
-
- public static SetInternetAccessPayload.Builder setInternetAccessBuilder() {
- return new AutoValue_Nic_Request_SetInternetAccessPayload.Builder();
- }
-
- @AutoValue
- public abstract static class CreatePayload {
-
- public abstract String serverId();
-
- public abstract int lanId();
-
- @Nullable
- public abstract String ip();
-
- @Nullable
- public abstract String name();
-
- @Nullable
- public abstract Boolean dhcpActive();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder serverId(String serverId);
-
- public abstract Builder lanId(int lanId);
-
- public abstract Builder ip(String ip);
-
- public abstract Builder name(String name);
-
- public abstract Builder dhcpActive(Boolean dhcpActive);
-
- abstract CreatePayload autoBuild();
-
- public CreatePayload build() {
- CreatePayload payload = autoBuild();
- if (payload.ip() != null)
- checkIp(payload.ip());
- checkLanId(payload.lanId());
-
- return payload;
- }
- }
- }
-
- @AutoValue
- public abstract static class UpdatePayload {
-
- public abstract String id();
-
- @Nullable
- public abstract String ip();
-
- @Nullable
- public abstract String name();
-
- @Nullable
- public abstract Boolean dhcpActive();
-
- @Nullable
- public abstract Integer lanId();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder id(String id);
-
- public abstract Builder ip(String ip);
-
- public abstract Builder name(String name);
-
- public abstract Builder dhcpActive(Boolean dhcpActive);
-
- public abstract Builder lanId(Integer lanId);
-
- abstract UpdatePayload autoBuild();
-
- public UpdatePayload build() {
- UpdatePayload payload = autoBuild();
- if (payload.ip() != null)
- checkIp(payload.ip());
- if (payload.lanId() != null)
- checkLanId(payload.lanId());
-
- return payload;
- }
- }
- }
-
- @AutoValue
- public abstract static class SetInternetAccessPayload {
-
- public abstract String dataCenterId();
-
- public abstract int lanId();
-
- public abstract boolean internetAccess();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder dataCenterId(String dataCenterId);
-
- public abstract Builder lanId(int lanId);
-
- public abstract Builder internetAccess(boolean internetAccess);
-
- public abstract SetInternetAccessPayload build();
-
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/domain/OsType.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/OsType.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/OsType.java
deleted file mode 100644
index 25bc70b..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/OsType.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.common.base.Enums;
-
-public enum OsType {
-
- WINDOWS, LINUX, OTHER, UNRECOGNIZED;
-
- public static OsType fromValue(String v) {
- return Enums.getIfPresent(OsType.class, v).or(UNRECOGNIZED);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Provisionable.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Provisionable.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Provisionable.java
deleted file mode 100644
index d3d29d4..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Provisionable.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.common.base.Enums;
-
-/**
- * Marker interface for {@link org.jclouds.profitbricks.domain.Image} and
- * {@link org.jclouds.profitbricks.domain.Snapshot}
- */
-public interface Provisionable {
-
- public enum Type {
-
- IMAGE, SNAPSHOT;
-
- public static Type fromValue(String v) {
- return Enums.getIfPresent(Type.class, v).or(IMAGE);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/domain/ProvisioningState.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/ProvisioningState.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/ProvisioningState.java
deleted file mode 100644
index d00342e..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/ProvisioningState.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.common.base.Enums;
-
-public enum ProvisioningState {
-
- INACTIVE, INPROCESS, AVAILABLE, DELETED, ERROR, UNRECOGNIZED;
-
- public static ProvisioningState fromValue(String value) {
- return Enums.getIfPresent(ProvisioningState.class, value).or(UNRECOGNIZED);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index a36112d..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Server.java
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * 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 static org.jclouds.profitbricks.util.Preconditions.checkCores;
-import static org.jclouds.profitbricks.util.Preconditions.checkRam;
-
-import java.util.Date;
-import java.util.List;
-
-import com.google.auto.value.AutoValue;
-import com.google.common.base.Enums;
-import com.google.common.collect.ImmutableList;
-
-import org.jclouds.javax.annotation.Nullable;
-
-@AutoValue
-public abstract class Server {
-
- public enum Status {
-
- NOSTATE, RUNNING, BLOCKED, PAUSED, SHUTDOWN, SHUTOFF, CRASHED, UNRECOGNIZED;
-
- public String value() {
- return name();
- }
-
- public static Status fromValue(String v) {
- return Enums.getIfPresent(Status.class, v).or(UNRECOGNIZED);
- }
- }
-
- @Nullable
- public abstract DataCenter dataCenter();
-
- @Nullable
- public abstract String id();
-
- @Nullable
- public abstract String name();
-
- @Nullable
- public abstract Integer cores();
-
- @Nullable
- public abstract Integer ram();
-
- @Nullable
- public abstract Boolean hasInternetAccess();
-
- @Nullable
- public abstract ProvisioningState state();
-
- @Nullable
- public abstract Status status();
-
- @Nullable
- public abstract OsType osType();
-
- @Nullable
- public abstract AvailabilityZone availabilityZone();
-
- @Nullable
- public abstract Date creationTime();
-
- @Nullable
- public abstract Date lastModificationTime();
-
- @Nullable
- public abstract List<Storage> storages();
-
- @Nullable
- public abstract List<Nic> nics();
-
- @Nullable
- public abstract String balancedNicId();
-
- @Nullable
- public abstract Boolean loadBalanced();
-
- @Nullable
- public abstract Boolean isCpuHotPlug();
-
- @Nullable
- public abstract Boolean isCpuHotUnPlug();
-
- @Nullable
- public abstract Boolean isRamHotPlug();
-
- @Nullable
- public abstract Boolean isRamHotUnPlug();
-
- @Nullable
- public abstract Boolean isNicHotPlug();
-
- @Nullable
- public abstract Boolean isNicHotUnPlug();
-
- @Nullable
- public abstract Boolean isDiscVirtioHotPlug();
-
- @Nullable
- public abstract Boolean isDiscVirtioHotUnPlug();
-
- @Nullable
- public abstract String hostname(); // Non-profitbricks property; Added to hold hostname parsed from image temporarily
-
- public static Builder builder() {
- return new AutoValue_Server.Builder()
- .storages(ImmutableList.<Storage>of())
- .nics(ImmutableList.<Nic>of());
- }
-
- public abstract Builder toBuilder();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder dataCenter(DataCenter dataCenter);
-
- public abstract Builder id(String id);
-
- public abstract Builder name(String name);
-
- public abstract Builder cores(Integer cores);
-
- public abstract Builder ram(Integer ram);
-
- public abstract Builder hasInternetAccess(Boolean internetAccess);
-
- public abstract Builder state(ProvisioningState state);
-
- public abstract Builder status(Status status);
-
- public abstract Builder osType(OsType osType);
-
- public abstract Builder availabilityZone(AvailabilityZone availabilityZone);
-
- public abstract Builder creationTime(Date creationTime);
-
- public abstract Builder lastModificationTime(Date lastModificationTime);
-
- public abstract Builder storages(List<Storage> storages);
-
- public abstract Builder nics(List<Nic> nics);
-
- public abstract Builder balancedNicId(String balancedNicIds);
-
- public abstract Builder loadBalanced(Boolean isLoadBalanced);
-
- public abstract Builder isCpuHotPlug(Boolean isCpuHotPlug);
-
- public abstract Builder isCpuHotUnPlug(Boolean isCpuHotUnPlug);
-
- public abstract Builder isRamHotPlug(Boolean isRamHotPlug);
-
- public abstract Builder isRamHotUnPlug(Boolean isRamHotUnPlug);
-
- public abstract Builder isNicHotPlug(Boolean isNicHotPlug);
-
- public abstract Builder isNicHotUnPlug(Boolean isNicHotUnPlug);
-
- public abstract Builder isDiscVirtioHotPlug(Boolean isDiscVirtioHotPlug);
-
- public abstract Builder isDiscVirtioHotUnPlug(Boolean isDiscVirtioHotUnPlug);
-
- public abstract Builder hostname(String hostname);
-
- abstract Server autoBuild();
-
- public Server build() {
- Server server = autoBuild();
- if (server.cores() != null)
- checkCores(server.cores());
- if (server.ram() != null)
- checkRam(server.ram(), server.isRamHotUnPlug());
- return server.toBuilder()
- .storages(ImmutableList.copyOf(server.storages()))
- .nics(ImmutableList.copyOf(server.nics()))
- .autoBuild();
- }
- }
-
- public static final class Request {
-
- public static CreatePayload.Builder creatingBuilder() {
- return new AutoValue_Server_Request_CreatePayload.Builder();
- }
-
- public static UpdatePayload.Builder updatingBuilder() {
- return new AutoValue_Server_Request_UpdatePayload.Builder();
- }
-
- @AutoValue
- public abstract static class CreatePayload {
-
- public abstract int cores();
-
- public abstract int ram();
-
- public abstract String dataCenterId();
-
- public abstract String name();
-
- @Nullable
- public abstract String bootFromStorageId();
-
- @Nullable
- public abstract String bootFromImageId();
-
- @Nullable
- public abstract Integer lanId();
-
- @Nullable
- public abstract Boolean hasInternetAccess();
-
- @Nullable
- public abstract AvailabilityZone availabilityZone();
-
- @Nullable
- public abstract OsType osType();
-
- @Nullable
- public abstract Boolean isCpuHotPlug();
-
- @Nullable
- public abstract Boolean isCpuHotUnPlug();
-
- @Nullable
- public abstract Boolean isRamHotPlug();
-
- @Nullable
- public abstract Boolean isRamHotUnPlug();
-
- @Nullable
- public abstract Boolean isNicHotPlug();
-
- @Nullable
- public abstract Boolean isNicHotUnPlug();
-
- @Nullable
- public abstract Boolean isDiscVirtioHotPlug();
-
- @Nullable
- public abstract Boolean isDiscVirtioHotUnPlug();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder cores(int cores);
-
- public abstract Builder ram(int ram);
-
- public abstract Builder dataCenterId(String dataCenterId);
-
- public abstract Builder name(String name);
-
- public abstract Builder bootFromStorageId(String bootFromStorageId);
-
- public abstract Builder bootFromImageId(String bootFromImageId);
-
- public abstract Builder lanId(Integer lanId);
-
- public abstract Builder hasInternetAccess(Boolean hasInternetAccess);
-
- public abstract Builder availabilityZone(AvailabilityZone availabilityZone);
-
- public abstract Builder osType(OsType osType);
-
- public abstract Builder isCpuHotPlug(Boolean isCpuHotPlug);
-
- public abstract Builder isCpuHotUnPlug(Boolean isCpuHotUnPlug);
-
- public abstract Builder isRamHotPlug(Boolean isRamHotPlug);
-
- public abstract Builder isRamHotUnPlug(Boolean isRamHotUnPlug);
-
- public abstract Builder isNicHotPlug(Boolean isNicHotPlug);
-
- public abstract Builder isNicHotUnPlug(Boolean isNicHotUnPlug);
-
- public abstract Builder isDiscVirtioHotPlug(Boolean isDiscVirtioHotPlug);
-
- public abstract Builder isDiscVirtioHotUnPlug(Boolean isDiscVirtioHotUnPlug);
-
- abstract CreatePayload autoBuild();
-
- public CreatePayload build() {
- CreatePayload payload = autoBuild();
- checkCores(payload.cores());
- checkRam(payload.ram(), payload.isRamHotUnPlug());
- return payload;
- }
- }
-
- }
-
- @AutoValue
- public abstract static class UpdatePayload {
-
- public abstract String id();
-
- @Nullable
- public abstract Integer cores();
-
- @Nullable
- public abstract Integer ram();
-
- @Nullable
- public abstract String name();
-
- @Nullable
- public abstract String bootFromStorageId();
-
- @Nullable
- public abstract String bootFromImageId();
-
- @Nullable
- public abstract AvailabilityZone availabilityZone();
-
- @Nullable
- public abstract OsType osType();
-
- @Nullable
- public abstract Boolean isCpuHotPlug();
-
- @Nullable
- public abstract Boolean isCpuHotUnPlug();
-
- @Nullable
- public abstract Boolean isRamHotPlug();
-
- @Nullable
- public abstract Boolean isRamHotUnPlug();
-
- @Nullable
- public abstract Boolean isNicHotPlug();
-
- @Nullable
- public abstract Boolean isNicHotUnPlug();
-
- @Nullable
- public abstract Boolean isDiscVirtioHotPlug();
-
- @Nullable
- public abstract Boolean isDiscVirtioHotUnPlug();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder id(String id);
-
- public abstract Builder cores(Integer cores);
-
- public abstract Builder ram(Integer ram);
-
- public abstract Builder name(String name);
-
- public abstract Builder bootFromStorageId(String bootFromStorageId);
-
- public abstract Builder bootFromImageId(String bootFromImageId);
-
- public abstract Builder availabilityZone(AvailabilityZone availabilityZone);
-
- public abstract Builder osType(OsType osType);
-
- public abstract Builder isCpuHotPlug(Boolean isCpuHotPlug);
-
- public abstract Builder isCpuHotUnPlug(Boolean isCpuHotUnPlug);
-
- public abstract Builder isRamHotPlug(Boolean isRamHotPlug);
-
- public abstract Builder isRamHotUnPlug(Boolean isRamHotUnPlug);
-
- public abstract Builder isNicHotPlug(Boolean isNicHotPlug);
-
- public abstract Builder isNicHotUnPlug(Boolean isNicHotUnPlug);
-
- public abstract Builder isDiscVirtioHotPlug(Boolean isDiscVirtioHotPlug);
-
- public abstract Builder isDiscVirtioHotUnPlug(Boolean isDiscVirtioHotUnPlug);
-
- abstract UpdatePayload autoBuild();
-
- public UpdatePayload build() {
- UpdatePayload payload = autoBuild();
- if (payload.cores() != null)
- checkCores(payload.cores());
- if (payload.ram() != null)
- checkRam(payload.ram(), payload.isRamHotUnPlug());
- return payload;
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/domain/ServiceFault.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/ServiceFault.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/ServiceFault.java
deleted file mode 100644
index bcf9774..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/ServiceFault.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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;
-
-@AutoValue
-public abstract class ServiceFault {
-
- public enum FaultCode {
-
- BAD_REQUEST,
- UNEXPECTED,
- UNAUTHORIZED,
- RESOURCE_NOT_FOUND,
- RESOURCE_DELETED,
- PROVISIONING_IN_PROCESS,
- PROVISIONING_NO_CHANGES,
- OVER_LIMIT_SETTING,
- SERVER_EXCEED_CAPACITY,
- SERVICE_UNAVAILABLE,
- UNRECOGNIZED;
-
- public static FaultCode fromValue(String v) {
- return Enums.getIfPresent(FaultCode.class, v).or(UNRECOGNIZED);
- }
- }
-
- public abstract FaultCode faultCode();
-
- public abstract int httpCode();
-
- public abstract String message();
-
- public abstract int requestId();
-
- public static Builder builder() {
- return new AutoValue_ServiceFault.Builder();
- }
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder faultCode(FaultCode faultCode);
-
- public abstract Builder httpCode(int httpCode);
-
- public abstract Builder message(String message);
-
- public abstract Builder requestId(int requestId);
-
- public abstract ServiceFault build();
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Snapshot.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Snapshot.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Snapshot.java
deleted file mode 100644
index 7f0be59..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Snapshot.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * 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 java.util.Date;
-
-import com.google.auto.value.AutoValue;
-
-import org.jclouds.javax.annotation.Nullable;
-
-@AutoValue
-public abstract class Snapshot implements Provisionable {
-
- @Nullable
- public abstract String id();
-
- @Nullable
- public abstract String name();
-
- @Nullable
- public abstract Float size();
-
- @Nullable
- public abstract Location location();
-
- @Nullable
- public abstract OsType osType();
-
- @Nullable
- public abstract Boolean isBootable();
-
- @Nullable
- public abstract String description();
-
- @Nullable
- public abstract Date creationTime();
-
- @Nullable
- public abstract Date lastModificationTime();
-
- @Nullable
- public abstract ProvisioningState state();
-
- @Nullable
- public abstract Boolean isCpuHotPlug();
-
- @Nullable
- public abstract Boolean isCpuHotUnPlug();
-
- @Nullable
- public abstract Boolean isRamHotPlug();
-
- @Nullable
- public abstract Boolean isRamHotUnPlug();
-
- @Nullable
- public abstract Boolean isNicHotPlug();
-
- @Nullable
- public abstract Boolean isNicHotUnPlug();
-
- @Nullable
- public abstract Boolean isDiscVirtioHotPlug();
-
- @Nullable
- public abstract Boolean isDiscVirtioHotUnPlug();
-
- public static Builder builder() {
- return new AutoValue_Snapshot.Builder();
- }
-
- public abstract Builder toBuilder();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder id(String id);
-
- public abstract Builder name(String name);
-
- public abstract Builder size(Float size);
-
- public abstract Builder location(Location location);
-
- public abstract Builder osType(OsType osType);
-
- public abstract Builder isBootable(Boolean bootable);
-
- public abstract Builder description(String description);
-
- public abstract Builder creationTime(Date creationTime);
-
- public abstract Builder lastModificationTime(Date lastModificationTime);
-
- public abstract Builder state(ProvisioningState state);
-
- public abstract Builder isCpuHotPlug(Boolean isCpuHotPlug);
-
- public abstract Builder isCpuHotUnPlug(Boolean isCpuHotUnPlug);
-
- public abstract Builder isRamHotPlug(Boolean isRamHotPlug);
-
- public abstract Builder isRamHotUnPlug(Boolean isRamHotUnPlug);
-
- public abstract Builder isNicHotPlug(Boolean isNicHotPlug);
-
- public abstract Builder isNicHotUnPlug(Boolean isNicHotUnPlug);
-
- public abstract Builder isDiscVirtioHotPlug(Boolean isDiscVirtioHotPlug);
-
- public abstract Builder isDiscVirtioHotUnPlug(Boolean isDiscVirtioHotUnPlug);
-
- public abstract Snapshot build();
- }
-
- public static final class Request {
-
- public static CreatePayload.Builder creatingBuilder() {
- return new AutoValue_Snapshot_Request_CreatePayload.Builder();
- }
-
- public static UpdatePayload.Builder updatingBuilder() {
- return new AutoValue_Snapshot_Request_UpdatePayload.Builder();
- }
-
- public static RollbackPayload createRollbackPayload(String snapshotId, String storageId) {
- return new AutoValue_Snapshot_Request_RollbackPayload(snapshotId, storageId);
- }
-
- @AutoValue
- public abstract static class CreatePayload {
-
- public abstract String storageId();
-
- public abstract String name();
-
- @Nullable
- public abstract String description();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder storageId(String storageId);
-
- public abstract Builder name(String name);
-
- public abstract Builder description(String description);
-
- public abstract CreatePayload build();
- }
- }
-
- @AutoValue
- public abstract static class UpdatePayload {
-
- public abstract String id();
-
- @Nullable
- public abstract String description();
-
- @Nullable
- public abstract String name();
-
- @Nullable
- public abstract Boolean bootable();
-
- @Nullable
- public abstract OsType osType();
-
- @Nullable
- public abstract Boolean isCpuHotPlug();
-
- @Nullable
- public abstract Boolean isCpuHotUnPlug();
-
- @Nullable
- public abstract Boolean isRamHotPlug();
-
- @Nullable
- public abstract Boolean isRamHotUnPlug();
-
- @Nullable
- public abstract Boolean isNicHotPlug();
-
- @Nullable
- public abstract Boolean isNicHotUnPlug();
-
- @Nullable
- public abstract Boolean isDiscVirtioHotPlug();
-
- @Nullable
- public abstract Boolean isDiscVirtioHotUnPlug();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder id(String snapshotId);
-
- public abstract Builder description(String description);
-
- public abstract Builder name(String name);
-
- public abstract Builder bootable(Boolean bootable);
-
- public abstract Builder osType(OsType osType);
-
- public abstract Builder isCpuHotPlug(Boolean isCpuHotPlug);
-
- public abstract Builder isCpuHotUnPlug(Boolean isCpuHotUnPlug);
-
- public abstract Builder isRamHotPlug(Boolean isRamHotPlug);
-
- public abstract Builder isRamHotUnPlug(Boolean isRamHotUnPlug);
-
- public abstract Builder isNicHotPlug(Boolean isNicHotPlug);
-
- public abstract Builder isNicHotUnPlug(Boolean isNicHotUnPlug);
-
- public abstract Builder isDiscVirtioHotPlug(Boolean isDiscVirtioHotPlug);
-
- public abstract Builder isDiscVirtioHotUnPlug(Boolean isDiscVirtioHotUnPlug);
-
- public abstract UpdatePayload build();
- }
-
- }
-
- @AutoValue
- public abstract static class RollbackPayload {
-
- public abstract String snapshotId();
-
- public abstract String storageId();
-
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Storage.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Storage.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Storage.java
deleted file mode 100644
index 6a0e8a9..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Storage.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * 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 static org.jclouds.profitbricks.util.Preconditions.checkPassword;
-import static org.jclouds.profitbricks.util.Preconditions.checkSize;
-
-import java.util.Date;
-import java.util.List;
-
-import com.google.auto.value.AutoValue;
-import com.google.common.base.Enums;
-import com.google.common.collect.ImmutableList;
-import org.jclouds.javax.annotation.Nullable;
-
-
-@AutoValue
-public abstract class Storage {
-
- public enum BusType {
-
- IDE, SCSI, VIRTIO, UNRECOGNIZED;
-
- public static BusType fromValue(String value) {
- return Enums.getIfPresent(BusType.class, value).or(UNRECOGNIZED);
- }
- }
-
- public abstract String id();
-
- @Nullable
- public abstract String name();
-
- public abstract float size(); // GB
-
- @Nullable
- public abstract Date creationTime();
-
- @Nullable
- public abstract Date lastModificationTime();
-
- @Nullable
- public abstract ProvisioningState state();
-
- @Nullable
- public abstract List<String> serverIds();
-
- @Nullable
- public abstract Boolean bootDevice();
-
- @Nullable
- public abstract BusType busType();
-
- @Nullable
- public abstract Integer deviceNumber();
-
- public static Builder builder() {
- return new AutoValue_Storage.Builder()
- .serverIds(ImmutableList.<String>of());
- }
-
- public abstract Builder toBuilder();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder id(String id);
-
- public abstract Builder name(String name);
-
- public abstract Builder size(float size);
-
- public abstract Builder creationTime(Date creationTime);
-
- public abstract Builder lastModificationTime(Date lastModificationTime);
-
- public abstract Builder state(ProvisioningState state);
-
- public abstract Builder serverIds(List<String> serverIds);
-
- public abstract Builder bootDevice(Boolean bootDevice);
-
- public abstract Builder busType(BusType busType);
-
- public abstract Builder deviceNumber(Integer deviceNumber);
-
- abstract Storage autoBuild();
-
- public Storage build(){
- Storage built = autoBuild();
- return built.toBuilder()
- .serverIds(ImmutableList.copyOf(built.serverIds()))
- .autoBuild();
- }
-
- }
-
- public static final class Request {
-
- public static CreatePayload.Builder creatingBuilder() {
- return new AutoValue_Storage_Request_CreatePayload.Builder();
- }
-
- public static UpdatePayload.Builder updatingBuilder() {
- return new AutoValue_Storage_Request_UpdatePayload.Builder();
- }
-
- public static ConnectPayload.Builder connectingBuilder() {
- return new AutoValue_Storage_Request_ConnectPayload.Builder();
- }
-
- @AutoValue
- public abstract static class CreatePayload {
-
- public abstract String dataCenterId();
-
- public abstract float size();
-
- @Nullable
- public abstract String name();
-
- @Nullable
- public abstract String mountImageId();
-
- @Nullable
- public abstract String imagePassword();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder dataCenterId(String dataCenterId);
-
- public abstract Builder size(float size);
-
- public abstract Builder name(String name);
-
- public abstract Builder mountImageId(String mountImageId);
-
- public abstract Builder imagePassword(String profitBricksImagePassword);
-
- abstract CreatePayload autoBuild();
-
- public CreatePayload build() {
- CreatePayload payload = autoBuild();
- if (payload.imagePassword() != null)
- checkPassword(payload.imagePassword());
- checkSize(payload.size());
-
- return payload;
- }
- }
- }
-
- @AutoValue
- public abstract static class UpdatePayload {
-
- public abstract String id();
-
- @Nullable
- public abstract Float size();
-
- @Nullable
- public abstract String name();
-
- @Nullable
- public abstract String mountImageId();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder id(String id);
-
- public abstract Builder size(Float size);
-
- public abstract Builder name(String name);
-
- public abstract Builder mountImageId(String mountImageId);
-
- abstract UpdatePayload autoBuild();
-
- public UpdatePayload build() {
- UpdatePayload payload = autoBuild();
- if (payload.size() != null)
- checkSize(payload.size());
-
- return payload;
- }
- }
- }
-
- @AutoValue
- public abstract static class ConnectPayload {
-
- public abstract String storageId();
-
- public abstract String serverId();
-
- @Nullable
- public abstract BusType busType();
-
- @Nullable
- public abstract Integer deviceNumber();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder storageId(String storageId);
-
- public abstract Builder serverId(String serverId);
-
- public abstract Builder busType(BusType busType);
-
- public abstract Builder deviceNumber(Integer deviceNumber);
-
- public abstract ConnectPayload build();
- }
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/features/DataCenterApi.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/features/DataCenterApi.java b/profitbricks/src/main/java/org/jclouds/profitbricks/features/DataCenterApi.java
deleted file mode 100644
index f660730..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/features/DataCenterApi.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * 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 java.util.List;
-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 org.jclouds.Fallbacks;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.profitbricks.binder.datacenter.CreateDataCenterRequestBinder;
-import org.jclouds.profitbricks.binder.datacenter.UpdateDataCenterRequestBinder;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.http.filters.ProfitBricksSoapMessageEnvelope;
-import org.jclouds.profitbricks.http.parser.datacenter.DataCenterInfoResponseHandler;
-import org.jclouds.profitbricks.http.parser.datacenter.DataCenterListResponseHandler;
-import org.jclouds.profitbricks.http.parser.state.GetProvisioningStateResponseHandler;
-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 DataCenterApi {
-
- /**
- * @return Returns a list of all Virtual Data Centers created by the user, including ID, name and version number.
- */
- @POST
- @Named("datacenter:getall")
- @Payload("<ws:getAllDataCenters/>")
- @XMLResponseParser(DataCenterListResponseHandler.class)
- @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
- List<DataCenter> getAllDataCenters();
-
- /**
- * @param identifier Data Center identifier
- * @return Returns information about an existing virtual data center's state and configuration or <code>null</code>
- * if it doesn't exist.
- */
- @POST
- @Named("datacenter:get")
- @Payload("<ws:getDataCenter><dataCenterId>{id}</dataCenterId></ws:getDataCenter>")
- @XMLResponseParser(DataCenterInfoResponseHandler.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- DataCenter getDataCenter(@PayloadParam("id") String identifier);
-
- /**
- * This is a lightweight function for polling the current provisioning state of the Virtual Data Center. It is
- * recommended to use this function for large Virtual Data Centers to query request results.
- * <p>
- * @param identifier Data Center identifier
- */
- @POST
- @Named("datacenter:getstate")
- @Payload("<ws:getDataCenterState><dataCenterId>{id}</dataCenterId></ws:getDataCenterState>")
- @XMLResponseParser(GetProvisioningStateResponseHandler.class)
- ProvisioningState getDataCenterState(@PayloadParam("id") String identifier);
-
- /**
- * Creates and saves a new, empty Virtual Data Center. Returns its identifier for further reference.
- * <p>
- * <b>Note: </b>Data center names cannot start with or contain (@, /, \, |, ‘’, ‘)
- * <p>
- * @param createRequest VDC payload containing dataCenterName, region
- * @return Response containing requestId, dataCenterId, version, and location
- */
- @POST
- @Named("datacenter:create")
- @MapBinder(CreateDataCenterRequestBinder.class)
- @XMLResponseParser(DataCenterInfoResponseHandler.class)
- DataCenter createDataCenter(@PayloadParam("dataCenter") DataCenter.Request.CreatePayload createRequest);
-
- /**
- * Updates the information associated to an existing Virtual Data Center.
- * <p>
- * @param updateRequest VDC payload containing dataCenterId, and name
- * @return Response containing requestId, dataCenterId, version
- */
- @POST
- @Named("datacenter:update")
- @MapBinder(UpdateDataCenterRequestBinder.class)
- @XMLResponseParser(DataCenterInfoResponseHandler.class)
- DataCenter updateDataCenter(@PayloadParam("dataCenter") DataCenter.Request.UpdatePayload updateRequest);
-
- /**
- * Removes all components from an existing Virtual Data Center.
- * <p>
- * @param identifier Identifier of the virtual data center
- * @return Response containing requestId, dataCenterId, version
- */
- @POST
- @Named("datacenter:clear")
- @Payload("<ws:clearDataCenter><dataCenterId>{id}</dataCenterId></ws:clearDataCenter>")
- @XMLResponseParser(DataCenterInfoResponseHandler.class)
- DataCenter clearDataCenter(@PayloadParam("id") String identifier);
-
- /**
- * Deletes an Virtual Data Center. If a previous request on the target data center is still in progress, the data
- * center is going to be deleted after this request has been completed. Once a Data Center has been deleted, no
- * further request can be performed on it.
- * <p>
- * @param identifier Identifier of the virtual data center
- * @return Returns a boolean indicating whether delete operation was made
- */
- @POST
- @Named("datacenter:delete")
- @Payload("<ws:deleteDataCenter><dataCenterId>{id}</dataCenterId></ws:deleteDataCenter>")
- @Fallback(Fallbacks.FalseOnNotFoundOr404.class)
- boolean deleteDataCenter(@PayloadParam("id") String identifier);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/features/DrivesApi.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/features/DrivesApi.java b/profitbricks/src/main/java/org/jclouds/profitbricks/features/DrivesApi.java
deleted file mode 100644
index 70f70a0..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/features/DrivesApi.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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 org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.profitbricks.binder.drive.AddRomDriveToServerRequestBinder;
-import org.jclouds.profitbricks.domain.Drive;
-import org.jclouds.profitbricks.http.filters.ProfitBricksSoapMessageEnvelope;
-import org.jclouds.profitbricks.http.parser.RequestIdOnlyResponseHandler;
-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 DrivesApi {
-
- @POST
- @Named("drives:add")
- @MapBinder(AddRomDriveToServerRequestBinder.class)
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String addRomDriveToServer(@PayloadParam("payload") Drive.Request.AddRomDriveToServerPayload payload);
-
- @POST
- @Named("drives:remove")
- @Payload("<ws:removeRomDriveFromServer><imageId>{imageid}</imageId><serverId>{serverid}</serverId></ws:removeRomDriveFromServer>")
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String removeRomDriveFromServer(@PayloadParam("imageid") String imageid, @PayloadParam("serverid") String serverid);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/features/FirewallApi.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/features/FirewallApi.java b/profitbricks/src/main/java/org/jclouds/profitbricks/features/FirewallApi.java
deleted file mode 100644
index f0aefb9..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/features/FirewallApi.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 java.util.List;
-
-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 org.jclouds.Fallbacks;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.profitbricks.binder.firewall.AddFirewallRuleToNicRequestBinder;
-import org.jclouds.profitbricks.binder.firewall.FirewallBinder.ActivateFirewallRequestBinder;
-import org.jclouds.profitbricks.binder.firewall.FirewallBinder.DeactivateFirewallRequestBinder;
-import org.jclouds.profitbricks.binder.firewall.FirewallBinder.DeleteFirewallRequestBinder;
-import org.jclouds.profitbricks.binder.firewall.FirewallBinder.RemoveFirewallRuleRequestBinder;
-import org.jclouds.profitbricks.domain.Firewall;
-import org.jclouds.profitbricks.http.filters.ProfitBricksSoapMessageEnvelope;
-import org.jclouds.profitbricks.http.parser.firewall.FirewallListResponseHandler;
-import org.jclouds.profitbricks.http.parser.firewall.FirewallResponseHandler;
-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;
-import org.jclouds.rest.annotations.Fallback;
-
-@RequestFilters({BasicAuthentication.class, ProfitBricksSoapMessageEnvelope.class})
-@Consumes(MediaType.TEXT_XML)
-@Produces(MediaType.TEXT_XML)
-public interface FirewallApi {
-
- @POST
- @Named("firewall:get")
- @Payload("<ws:getFirewall><firewallId>{id}</firewallId></ws:getFirewall>")
- @XMLResponseParser(FirewallResponseHandler.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- Firewall getFirewall(@PayloadParam("id") String identifier);
-
- @POST
- @Named("firewall:getall")
- @Payload("<ws:getAllFirewalls/>")
- @XMLResponseParser(FirewallListResponseHandler.class)
- @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
- List<Firewall> getAllFirewalls();
-
- @POST
- @Named("firewall:addrule")
- @MapBinder(AddFirewallRuleToNicRequestBinder.class)
- @XMLResponseParser(FirewallResponseHandler.class)
- Firewall addFirewallRuleToNic(@PayloadParam("firewall") Firewall.Request.AddRulePayload payload);
-
- @POST
- @Named("firewall:removerule")
- @MapBinder(RemoveFirewallRuleRequestBinder.class)
- @Fallback(Fallbacks.FalseOnNotFoundOr404.class)
- boolean removeFirewallRules(@PayloadParam("ids") List<String> firewallRuleIds);
-
- @POST
- @Named("firewall:activate")
- @MapBinder(ActivateFirewallRequestBinder.class)
- @Fallback(Fallbacks.FalseOnNotFoundOr404.class)
- boolean activateFirewall(@PayloadParam("ids") List<String> firewallIds);
-
- @POST
- @Named("firewall:activate")
- @MapBinder(DeactivateFirewallRequestBinder.class)
- @Fallback(Fallbacks.FalseOnNotFoundOr404.class)
- boolean deactivateFirewall(@PayloadParam("ids") List<String> firewallIds);
-
- @POST
- @Named("firewall:activate")
- @MapBinder(DeleteFirewallRequestBinder.class)
- @Fallback(Fallbacks.FalseOnNotFoundOr404.class)
- boolean deleteFirewall(@PayloadParam("ids") List<String> firewallIds);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/features/ImageApi.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/features/ImageApi.java b/profitbricks/src/main/java/org/jclouds/profitbricks/features/ImageApi.java
deleted file mode 100644
index 95d27c4..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/features/ImageApi.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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 java.util.List;
-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 org.jclouds.Fallbacks;
-
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.profitbricks.domain.Image;
-import org.jclouds.profitbricks.http.filters.ProfitBricksSoapMessageEnvelope;
-import org.jclouds.profitbricks.http.parser.image.ImageInfoResponseHandler;
-import org.jclouds.profitbricks.http.parser.image.ImageListResponseHandler;
-import org.jclouds.rest.annotations.Fallback;
-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 ImageApi {
-
- /**
- * @return Outputs a list of all HDD and/or CD-ROM/DVD images existing on or uploaded to the ProfitBricks FTP server.
- */
- @POST
- @Named("image:getall")
- @Payload("<ws:getAllImages/>")
- @XMLResponseParser(ImageListResponseHandler.class)
- @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
- List<Image> getAllImages();
-
- /**
- *
- * @param identifier Image Id
- * @return Returns information about a HDD or CD-ROM/DVD (ISO) image.
- */
- @POST
- @Named("image:get")
- @Payload("<ws:getImage><imageId>{id}</imageId></ws:getImage>")
- @XMLResponseParser(ImageInfoResponseHandler.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- Image getImage(@PayloadParam("id") String identifier);
-}
[03/11] jclouds-labs git commit: Remove ProfitBricks
Posted by de...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/StorageApiMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/StorageApiMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/StorageApiMockTest.java
deleted file mode 100644
index 10a4a49..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/StorageApiMockTest.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.Storage;
-import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
-import org.testng.annotations.Test;
-
-import com.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-
-@Test(groups = "unit", testName = "StorageApiMockTest")
-public class StorageApiMockTest extends BaseProfitBricksMockTest {
-
- @Test
- public void testGetAllStorages() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/storage/storages.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- StorageApi api = pbApi.storageApi();
-
- try {
- List<Storage> storages = api.getAllStorages();
- assertRequestHasCommonProperties(server.takeRequest(), "<ws:getAllStorages/>");
- assertNotNull(storages);
- assertTrue(storages.size() == 2);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetAllStoragesReturning404() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- StorageApi api = pbApi.storageApi();
-
- try {
- List<Storage> storages = api.getAllStorages();
- assertRequestHasCommonProperties(server.takeRequest());
- assertTrue(storages.isEmpty());
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetStorage() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/storage/storage.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- StorageApi api = pbApi.storageApi();
-
- String id = "qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh";
-
- String content = "<ws:getStorage><storageId>" + id + "</storageId></ws:getStorage>";
- try {
- Storage storage = api.getStorage(id);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(storage);
- assertEquals(storage.id(), id);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetNonExistingStorage() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- StorageApi api = pbApi.storageApi();
-
- String id = "random-non-existing-id";
- try {
- Storage storage = api.getStorage(id);
- assertRequestHasCommonProperties(server.takeRequest());
- assertNull(storage);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testConnectStorageToServer() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/storage/storage-connect.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- StorageApi api = pbApi.storageApi();
-
- String storageId = "qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh";
- String serverId = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
- String content = "<ws:connectStorageToServer><request>"
- + "<storageId>" + storageId + "</storageId>"
- + "<serverId>" + serverId + "</serverId>"
- + "<busType>VIRTIO</busType>"
- + "<deviceNumber>2</deviceNumber>"
- + "</request></ws:connectStorageToServer>";
- try {
- String requestId = api.connectStorageToServer(
- Storage.Request.connectingBuilder()
- .serverId(serverId)
- .storageId(storageId)
- .busType(Storage.BusType.VIRTIO)
- .deviceNumber(2)
- .build()
- );
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertEquals(requestId, "16463317");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDisconnectStorageFromServer() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/storage/storage-disconnect.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- StorageApi api = pbApi.storageApi();
-
- String storageId = "qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh";
- String serverId = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
- String content = "<ws:disconnectStorageFromServer>"
- + "<storageId>" + storageId + "</storageId>"
- + "<serverId>" + serverId + "</serverId>"
- + "</ws:disconnectStorageFromServer>";
-
- try {
- String requestId = api.disconnectStorageFromServer(storageId, serverId);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertEquals(requestId, "16463318");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testCreateStorage() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/storage/storage-create.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- StorageApi api = pbApi.storageApi();
-
- String dataCenterId = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
- String imageId = "f0a59a5c-7940-11e4-8053-52540066fee9";
-
- String content = "<ws:createStorage><request>"
- + "<dataCenterId>" + dataCenterId + "</dataCenterId>"
- + "<storageName>hdd-1</storageName>" + "<size>80</size>"
- + "<mountImageId>" + imageId + "</mountImageId>"
- + "<profitBricksImagePassword>qqqqqqqqq</profitBricksImagePassword>"
- + "</request></ws:createStorage>";
- try {
- String storageId = api.createStorage(
- Storage.Request.creatingBuilder()
- .dataCenterId(dataCenterId)
- .name("hdd-1")
- .size(80f)
- .mountImageId(imageId)
- .imagePassword("qqqqqqqqq")
- .build());
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(storageId);
- assertEquals(storageId, "qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testUpdateStorage() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/storage/storage-update.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- StorageApi api = pbApi.storageApi();
-
- String storageId = "qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh";
- String imageId = "f4742db0-9160-11e4-9d74-52540066fee9";
-
- String content = "<ws:updateStorage><request>"
- + "<storageId>" + storageId + "</storageId>"
- + "<size>20</size><storageName>hdd-2</storageName>"
- + "<mountImageId>" + imageId + "</mountImageId>"
- + "</request></ws:updateStorage>";
- try {
- String requestId = api.updateStorage(
- Storage.Request.updatingBuilder()
- .id(storageId)
- .size(20f)
- .name("hdd-2")
- .mountImageId(imageId)
- .build());
-
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(requestId);
- assertEquals(requestId, "1234568");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDeleteStorage() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/storage/storage-delete.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- StorageApi api = pbApi.storageApi();
-
- String storageId = "qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh";
-
- String content = "<ws:deleteStorage><storageId>" + storageId + "</storageId></ws:deleteStorage>";
-
- try {
- boolean result = api.deleteStorage(storageId);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertTrue(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDeleteNonExistingStorage() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- StorageApi api = pbApi.storageApi();
-
- String id = "random-non-existing-id";
- try {
- boolean result = api.deleteStorage(id);
- assertRequestHasCommonProperties(server.takeRequest());
- assertFalse(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/ResponseStatusFromPayloadHttpCommandExecutorServiceTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/ResponseStatusFromPayloadHttpCommandExecutorServiceTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/ResponseStatusFromPayloadHttpCommandExecutorServiceTest.java
deleted file mode 100644
index bb92109..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/ResponseStatusFromPayloadHttpCommandExecutorServiceTest.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * 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;
-
-import static org.jclouds.profitbricks.internal.BaseProfitBricksMockTest.mockWebServer;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.domain.Server;
-import org.jclouds.profitbricks.features.DataCenterApi;
-import org.jclouds.profitbricks.features.ServerApi;
-import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.InsufficientResourcesException;
-import org.jclouds.rest.ResourceNotFoundException;
-import org.testng.annotations.Test;
-
-import com.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-
-/**
- * Mock tests for the {@link ResponseStatusFromPayloadHttpCommandExecutorService} class.
- */
-@Test(groups = "unit", testName = "ResponseStatusFromPayloadHttpCommandExecutorServiceTest")
-public class ResponseStatusFromPayloadHttpCommandExecutorServiceTest extends BaseProfitBricksMockTest {
-
- private final int MAX_RETRIES = 5;
-
- @Test
- public void testNotFound() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(500).setBody(payloadFromResource("/fault-404.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl("/"));
- DataCenterApi api = pbApi.dataCenterApi();
-
- String id = "random-non-existing-id";
- try {
- api.clearDataCenter(id);
- fail("Request should have failed");
- } catch (Exception ex) {
- assertTrue(ex instanceof ResourceNotFoundException, "Exception should be an ResourceNotFoundException");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testBadRequest() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(500).setBody(payloadFromResource("/fault-400.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl("/"));
- DataCenterApi api = pbApi.dataCenterApi();
-
- try {
- api.createDataCenter(DataCenter.Request.creatingPayload("D@tacenter", Location.DE_FKB));
- fail("Request should have failed");
- } catch (Exception ex) {
- assertTrue(ex instanceof IllegalArgumentException, "Exception should be an IllegalArgumentException");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testUnauthorized() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(401).setBody(payloadFromResource("/fault-401.html")));
-
- ProfitBricksApi pbApi = api(server.getUrl("/"));
- DataCenterApi api = pbApi.dataCenterApi();
-
- try {
- api.clearDataCenter("some-datacenter-id");
- fail("Request should have failed");
- } catch (Exception ex) {
- assertTrue(ex instanceof AuthorizationException, "Exception should be an AuthorizationException");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testOverLimitSettings() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(503).setBody(payloadFromResource("/fault-413.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl("/"));
- ServerApi api = pbApi.serverApi();
-
- try {
- api.createServer(
- Server.Request.creatingBuilder()
- .dataCenterId("some-datacenter-id")
- .name("node1")
- .cores(99)
- .ram(12800)
- .build());
- fail("Request should have failed.");
- } catch (Exception ex) {
- assertTrue(ex instanceof InsufficientResourcesException, "Exception should be InsufficientResourcesException");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testServiceUnderMaintenance() throws Exception {
- MockWebServer server = mockWebServer();
- for (int i = 0; i <= MAX_RETRIES; i++) // jclouds retries 5 times
- server.enqueue(new MockResponse().setResponseCode(503).setBody(payloadFromResource("/maintenance-503.html")));
-
- ProfitBricksApi pbApi = api(server.getUrl("/"));
- DataCenterApi api = pbApi.dataCenterApi();
-
- try {
- api.clearDataCenter("some-datacenter-id");
- fail("Request should have failed.");
- } catch (Exception ex) {
- assertTrue(ex instanceof HttpResponseException, "Exception should be HttpResponseException");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/filters/ProfitBricksSoapMessageEnvelopeTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/filters/ProfitBricksSoapMessageEnvelopeTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/filters/ProfitBricksSoapMessageEnvelopeTest.java
deleted file mode 100644
index f6892b7..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/filters/ProfitBricksSoapMessageEnvelopeTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.filters;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.http.HttpRequest;
-import org.testng.annotations.Test;
-
-/**
- * Unit tests for the {@link ProfitBricksSoapMessageEnvelope} class.
- */
-@Test(groups = "unit", testName = "ProfitBricksSoapMessageEnvelopeTest")
-public class ProfitBricksSoapMessageEnvelopeTest {
-
- private final String SOAP_PREFIX
- = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">"
- + "<soapenv:Header/>"
- + "<soapenv:Body>";
- private final String SOAP_SUFFIX = "</soapenv:Body></soapenv:Envelope>";
- private final String endpoint = "https://api.profitbricks.com/1.3";
-
- @Test
- public void testPayloadEnclosedWithSoapTags() {
- String requestBody = "<ws:getAllDataCenters/>";
- String expectedPayload = SOAP_PREFIX.concat(requestBody).concat(SOAP_SUFFIX);
-
- HttpRequest request = HttpRequest.builder().method("POST").endpoint(endpoint).payload(requestBody).build();
-
- ProfitBricksSoapMessageEnvelope soapEnvelope = new ProfitBricksSoapMessageEnvelope();
- HttpRequest filtered = soapEnvelope.filter(request);
-
- assertEquals(filtered.getPayload().getRawContent(), expectedPayload);
- assertEquals(filtered.getPayload().getContentMetadata().getContentLength(), Long.valueOf(expectedPayload.getBytes().length));
- }
-
- @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = ".*must contain payload message.*")
- public void testNullRequest() {
- HttpRequest request = HttpRequest.builder().method("POST").endpoint(endpoint).build();
- new ProfitBricksSoapMessageEnvelope().filter(request);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/BaseResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/BaseResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/BaseResponseHandlerTest.java
deleted file mode 100644
index d481735..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/BaseResponseHandlerTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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;
-
-import static org.jclouds.util.Strings2.toStringAndClose;
-
-import java.io.IOException;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.http.functions.config.SaxParserModule;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-
-import com.google.common.base.Throwables;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-public abstract class BaseResponseHandlerTest<T> {
-
- protected Injector injector = null;
- protected ParseSax.Factory factory;
- protected GeneratedHttpRequest request;
-
- protected abstract ParseSax<T> createParser();
-
- @BeforeTest
- protected void setUpInjector() {
- injector = Guice.createInjector(new SaxParserModule());
- factory = injector.getInstance(ParseSax.Factory.class);
- assert factory != null;
- }
-
- protected String payloadFromResource(String resource) {
- try {
- return toStringAndClose(getClass().getResourceAsStream(resource));
- } catch (IOException e) {
- throw Throwables.propagate(e);
- }
- }
-
- @AfterTest
- protected void tearDownInjector() {
- factory = null;
- injector = null;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/RequestIdOnlyResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/RequestIdOnlyResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/RequestIdOnlyResponseHandlerTest.java
deleted file mode 100644
index 3ea9ed8..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/RequestIdOnlyResponseHandlerTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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;
-
-import org.jclouds.http.functions.ParseSax;
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "RequestIdOnlyResponseHandlerTest")
-public class RequestIdOnlyResponseHandlerTest extends BaseResponseHandlerTest<String> {
-
- @Override
- protected ParseSax<String> createParser() {
- return factory.create(injector.getInstance(RequestIdOnlyResponseHandler.class));
- }
-
- @Test
- public void testParseResponseFromStartServer() {
- ParseSax<String> parser = createParser();
-
- String requestId = parser.parse(payloadFromResource("/server/server-start.xml"));
-
- assertEquals(requestId, "123456");
- }
-
- @Test
- public void testParseResponseFromStopServer() {
- ParseSax<String> parser = createParser();
-
- String requestId = parser.parse(payloadFromResource("/server/server-stop.xml"));
-
- assertEquals(requestId, "123456");
- }
-
- @Test
- public void testParseResponseFromResetServer() {
- ParseSax<String> parser = createParser();
-
- String requestId = parser.parse(payloadFromResource("/server/server-reset.xml"));
-
- assertEquals(requestId, "123456");
- }
-
- @Test
- public void testParseResponseFromUpdateServer() {
- ParseSax<String> parser = createParser();
-
- String requestId = parser.parse(payloadFromResource("/server/server-update.xml"));
-
- assertEquals(requestId, "102458");
- }
-
- @Test
- public void testParseResponseFromDeleteServer() {
- ParseSax<String> parser = createParser();
-
- String requestId = parser.parse(payloadFromResource("/server/server-delete.xml"));
-
- assertEquals(requestId, "102459");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ServiceFaultResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ServiceFaultResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ServiceFaultResponseHandlerTest.java
deleted file mode 100644
index 2b54dd5..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ServiceFaultResponseHandlerTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.ServiceFault;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ServiceFaultResponseHandlerTest")
-public class ServiceFaultResponseHandlerTest extends BaseResponseHandlerTest<ServiceFault> {
-
- @Override
- protected ParseSax<ServiceFault> createParser() {
- return factory.create(injector.getInstance(ServiceFaultResponseHandler.class));
- }
-
- @Test
- public void testParseSoapServiceFault() {
- ParseSax<ServiceFault> parser = createParser();
- ServiceFault actual = parser.parse(payloadFromResource("/fault-404.xml"));
- assertNotNull(actual, "Parsed content returned null");
-
- ServiceFault expected = ServiceFault.builder()
- .faultCode(ServiceFault.FaultCode.RESOURCE_NOT_FOUND)
- .httpCode(404)
- .message("The requested resource could not be found. Please refer to Request Id : 16370720. [VDC-6-404] The requested resource does not exist or already deleted by the users. ResourceId random-non-existing-id")
- .requestId(16370720)
- .build();
-
- assertEquals(expected, actual);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterInfoResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterInfoResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterInfoResponseHandlerTest.java
deleted file mode 100644
index 3cb15a5..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterInfoResponseHandlerTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.datacenter;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.date.DateService;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.AvailabilityZone;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Firewall;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.domain.OsType;
-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 org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit", testName = "DataCenterInfoResponseHandlerTest")
-public class DataCenterInfoResponseHandlerTest extends BaseResponseHandlerTest<DataCenter> {
-
- @Override
- protected ParseSax<DataCenter> createParser() {
- return factory.create(injector.getInstance(DataCenterInfoResponseHandler.class));
- }
-
- protected DateService createDateParser() {
- return injector.getInstance(DateService.class);
- }
-
- @Test
- public void testParseResponseFromGetDataCenter() {
- ParseSax<DataCenter> parser = createParser();
-
- DataCenter actual = parser.parse(payloadFromResource("/datacenter/datacenter.xml"));
- assertNotNull(actual, "Parsed content returned null");
-
- DateService dateParser = createDateParser();
-
- DataCenter expected = DataCenter.builder()
- .id("12345678-abcd-efgh-ijkl-987654321000")
- .version(10)
- .name("JClouds-DC")
- .state(ProvisioningState.AVAILABLE)
- .location(Location.US_LAS)
- .servers(ImmutableList.<Server>of(
- Server.builder()
- .dataCenter(DataCenter.builder()
- .id("12345678-abcd-efgh-ijkl-987654321000")
- .version(10)
- .build()
- )
- .id("qqqqqqqq-wwww-eeee-rrrr-tttttttttttt")
- .name("jnode1")
- .cores(4)
- .ram(4096)
- .hasInternetAccess(true)
- .state(ProvisioningState.AVAILABLE)
- .status(Server.Status.RUNNING)
- .creationTime(dateParser.iso8601DateOrSecondsDateParse("2014-12-04T07:09:23.138Z"))
- .lastModificationTime(dateParser.iso8601DateOrSecondsDateParse("2014-12-12T03:08:35.629Z"))
- .osType(OsType.LINUX)
- .availabilityZone(AvailabilityZone.AUTO)
- .isCpuHotPlug(true)
- .isRamHotPlug(true)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .storages(ImmutableList.<Storage>of(
- Storage.builder()
- .bootDevice(Boolean.TRUE)
- .id("ssssssss-aaaa-ffff-gggg-hhhhhhhhhhhh")
- .busType(Storage.BusType.VIRTIO)
- .deviceNumber(1)
- .size(40f)
- .name("jnode1-disk1")
- .build()
- )
- )
- .nics(ImmutableList.<Nic>of(
- Nic.builder()
- .dataCenterId("12345678-abcd-efgh-ijkl-987654321000")
- .id("zzzzzzzz-xxxx-cccc-vvvv-bbbbbbbbbbbb")
- .lanId(1)
- .internetAccess(true)
- .serverId("qqqqqqqq-wwww-eeee-rrrr-tttttttttttt")
- .ips(ImmutableList.of("202.94.38.12"))
- .macAddress("02:01:09:cd:f0:b0")
- .firewall(
- Firewall.builder()
- .active(false)
- .id("llllllll-kkkk-jjjj-hhhh-gggggggggggg")
- .nicId("zzzzzzzz-xxxx-cccc-vvvv-bbbbbbbbbbbb")
- .state(ProvisioningState.AVAILABLE)
- .build()
- )
- .dhcpActive(true)
- .gatewayIp("202.94.38.1")
- .state(ProvisioningState.AVAILABLE)
- .build()
- )
- )
- .build()
- )
- )
- .storages(ImmutableList.<Storage>of(
- Storage.builder()
- .id("ssssssss-aaaa-ffff-gggg-hhhhhhhhhhhh")
- .size(40)
- .name("jnode1-disk1")
- .state(ProvisioningState.AVAILABLE)
- .creationTime(dateParser.iso8601DateOrSecondsDateParse("2014-12-04T07:09:23.138Z"))
- .lastModificationTime(dateParser.iso8601DateOrSecondsDateParse("2014-12-12T03:14:48.316Z"))
- .serverIds(ImmutableList.of(
- "qqqqqqqq-wwww-eeee-rrrr-tttttttttttt"
- ))
- .build()
- ))
- .build();
- assertEquals(actual, expected);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterListResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterListResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterListResponseHandlerTest.java
deleted file mode 100644
index 7e738ae..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterListResponseHandlerTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.datacenter;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.List;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit", testName = "DataCenterListResponseHandlerTest")
-public class DataCenterListResponseHandlerTest extends BaseResponseHandlerTest<List<DataCenter>> {
-
- @Override
- protected ParseSax<List<DataCenter>> createParser() {
- return factory.create(injector.getInstance(DataCenterListResponseHandler.class));
- }
-
- @Test
- public void testParseResponseFromGetAllDataCenter() {
- ParseSax<List<DataCenter>> parser = createParser();
-
- List<DataCenter> actual = parser.parse(payloadFromResource("/datacenter/datacenters.xml"));
- assertNotNull(actual, "Parsed content returned null");
-
- List<DataCenter> expected = ImmutableList.<DataCenter>of(
- DataCenter.builder().id("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee").name("JClouds-DC").version(10).state(ProvisioningState.AVAILABLE).build(),
- DataCenter.builder().id("qqqqqqqq-wwww-rrrr-tttt-yyyyyyyyyyyy").name("Random DC").version(238).state(ProvisioningState.INPROCESS).build()
- );
- assertEquals(expected, actual);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/firewall/FirewallListResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/firewall/FirewallListResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/firewall/FirewallListResponseHandlerTest.java
deleted file mode 100644
index a5fc74d..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/firewall/FirewallListResponseHandlerTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.firewall;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.List;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.Firewall;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit", testName = "FirewallListResponseHandlerTest")
-public class FirewallListResponseHandlerTest extends BaseResponseHandlerTest<List<Firewall>> {
-
- @Override
- protected ParseSax<List<Firewall>> createParser() {
- return factory.create(injector.getInstance(FirewallListResponseHandler.class));
- }
-
- @Test
- public void testParseResponseFromGetAllFirewalls() {
- ParseSax<List<Firewall>> parser = createParser();
- List<Firewall> actual = parser.parse(payloadFromResource("/firewall/firewalls.xml"));
- assertNotNull(actual, "Parsed content returned null");
-
- List<Firewall> expected = ImmutableList.of(
- Firewall.builder()
- .active(true)
- .id("firewall-id")
- .nicId("nic-id")
- .state(ProvisioningState.AVAILABLE)
- .rules(ImmutableList.of(
- Firewall.Rule.builder()
- .id("firewall-rule-id")
- .name("name")
- .portRangeEnd(45678)
- .portRangeStart(12345)
- .protocol(Firewall.Protocol.TCP)
- .sourceIp("192.168.0.1")
- .sourceMac("aa:bb:cc:dd:ee:ff")
- .targetIp("192.168.0.2")
- .build()
- ))
- .build(),
- Firewall.builder()
- .active(true)
- .id("firewall-id2")
- .nicId("nic-id")
- .state(ProvisioningState.AVAILABLE)
- .rules(ImmutableList.of(
- Firewall.Rule.builder()
- .id("firewall-rule-id2")
- .name("name")
- .portRangeEnd(56789)
- .portRangeStart(23456)
- .protocol(Firewall.Protocol.TCP)
- .sourceIp("192.168.0.2")
- .sourceMac("aa:bb:cc:dd:ee:ff")
- .targetIp("192.168.0.3")
- .build()
- ))
- .build()
- );
-
- assertEquals(actual, expected);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/firewall/FirewallResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/firewall/FirewallResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/firewall/FirewallResponseHandlerTest.java
deleted file mode 100644
index eeb4cba..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/firewall/FirewallResponseHandlerTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.firewall;
-
-import java.util.List;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.Firewall;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.profitbricks.domain.Firewall.Protocol;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit", testName = "FirewallResponseHandlerTest")
-public class FirewallResponseHandlerTest extends BaseResponseHandlerTest<Firewall> {
-
- @Override
- protected ParseSax<Firewall> createParser() {
- return factory.create(injector.getInstance(FirewallResponseHandler.class));
- }
-
- @Test
- public void testParseResponseFromGetFirewall() {
- ParseSax<Firewall> parser = createParser();
- Firewall actual = parser.parse(payloadFromResource("/firewall/firewall.xml"));
- assertNotNull(actual, "Parsed content returned null");
- List<Firewall.Rule> firewallRules = ImmutableList.of(
- Firewall.Rule.builder()
- .id("firewall-rule-id")
- .name("name")
- .portRangeEnd(45678)
- .portRangeStart(12345)
- .protocol(Protocol.TCP)
- .sourceIp("192.168.0.1")
- .sourceMac("aa:bb:cc:dd:ee:ff")
- .targetIp("192.168.0.2")
- .build());
-
- Firewall expected = Firewall.builder()
- .active(true)
- .id("firewall-id")
- .nicId("nic-id")
- .state(ProvisioningState.AVAILABLE)
- .rules(firewallRules)
- .build();
-
- assertEquals(expected, actual);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/image/ImageInfoResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/image/ImageInfoResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/image/ImageInfoResponseHandlerTest.java
deleted file mode 100644
index fb2e33d..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/image/ImageInfoResponseHandlerTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.image;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.Image;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.domain.OsType;
-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 = "ImageInfoResponseHandlerTest")
-public class ImageInfoResponseHandlerTest extends BaseResponseHandlerTest<Image> {
-
- @Override
- protected ParseSax<Image> createParser() {
- return factory.create(injector.getInstance(ImageInfoResponseHandler.class));
- }
-
- @Test
- public void testParseResponseFromGetImage() {
- ParseSax<Image> parser = createParser();
- Image actual = parser.parse(payloadFromResource("/image/image.xml"));
- assertNotNull(actual, "Parsed content returned null");
-
- Image expected = Image.builder()
- .isBootable(true)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(false)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .id("5ad99c9e-9166-11e4-9d74-52540066fee9")
- .name("Ubuntu-14.04-LTS-server-2015-01-01")
- .size(2048f)
- .type(Image.Type.HDD)
- .location(Location.US_LAS)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .osType(OsType.LINUX)
- .isPublic(true)
- .isRamHotPlug(true)
- .isRamHotUnPlug(false)
- .isWriteable(true)
- .build();
-
- assertEquals(expected, actual);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/image/ImageListResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/image/ImageListResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/image/ImageListResponseHandlerTest.java
deleted file mode 100644
index e954fb0..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/image/ImageListResponseHandlerTest.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * 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.image;
-
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.Image;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.domain.OsType;
-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 = "ImageListResponseHandlerTest")
-public class ImageListResponseHandlerTest extends BaseResponseHandlerTest<List<Image>> {
-
- @Override
- protected ParseSax<List<Image>> createParser() {
- return factory.create(injector.getInstance(ImageListResponseHandler.class));
- }
-
- @Test
- public void testParseResponseFromGetAllImages() {
- ParseSax<List<Image>> parser = createParser();
-
- List<Image> actual = parser.parse(payloadFromResource("/image/images.xml"));
- assertNotNull(actual, "Parsed content returned null");
-
- List<Image> expected = ImmutableList.<Image>of(
- Image.builder()
- .isBootable(true)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(false)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .id("e4f73936-9161-11e4-9d74-52540066fee9")
- .name("Ubuntu-12.04-LTS-server-2015-01-01")
- .size(2048f)
- .type(Image.Type.HDD)
- .location(Location.DE_FRA)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .osType(OsType.LINUX)
- .isPublic(true)
- .isRamHotPlug(true)
- .isRamHotUnPlug(false)
- .isWriteable(true)
- .build(),
- Image.builder()
- .isBootable(true)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(false)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .id("a984a5d3-9163-11e4-9d74-52540066fee9")
- .name("Ubuntu-14.04-LTS-server-2015-01-01")
- .size(2048f)
- .type(Image.Type.HDD)
- .location(Location.DE_FRA)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .osType(OsType.LINUX)
- .isPublic(true)
- .isRamHotPlug(true)
- .isRamHotUnPlug(false)
- .isWriteable(true)
- .build(),
- Image.builder()
- .isBootable(true)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(false)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .id("5f3cac96-915f-11e4-9d74-52540066fee9")
- .name("Debian-jessie-prerelease-server-2015-01-01")
- .size(2048f)
- .type(Image.Type.HDD)
- .location(Location.US_LASDEV)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .osType(OsType.LINUX)
- .isPublic(true)
- .isRamHotPlug(true)
- .isRamHotUnPlug(false)
- .isWriteable(true)
- .build(),
- Image.builder()
- .isBootable(true)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(false)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .id("f4742db0-9160-11e4-9d74-52540066fee9")
- .name("Fedora-19-server-2015-01-01")
- .size(2048f)
- .type(Image.Type.HDD)
- .location(Location.US_LASDEV)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .osType(OsType.LINUX)
- .isPublic(true)
- .isRamHotPlug(true)
- .isRamHotUnPlug(false)
- .isWriteable(true)
- .build(),
- Image.builder()
- .isBootable(true)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(false)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .id("86902c18-9164-11e4-9d74-52540066fee9")
- .name("Ubuntu-12.04-LTS-server-2015-01-01")
- .size(2048f)
- .type(Image.Type.HDD)
- .location(Location.US_LASDEV)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .osType(OsType.LINUX)
- .isPublic(true)
- .isRamHotPlug(true)
- .isRamHotUnPlug(false)
- .isWriteable(true)
- .build(),
- Image.builder()
- .isBootable(true)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(false)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .id("3b48e3ff-9163-11e4-9d74-52540066fee9")
- .name("Ubuntu-14.04-LTS-server-2015-01-01")
- .size(2048f)
- .type(Image.Type.HDD)
- .location(Location.DE_FKB)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .osType(OsType.LINUX)
- .isPublic(true)
- .isRamHotPlug(true)
- .isRamHotUnPlug(false)
- .isWriteable(true)
- .build(),
- Image.builder()
- .isBootable(true)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(false)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .id("6ce17716-9164-11e4-9d74-52540066fee9")
- .name("Ubuntu-12.04-LTS-server-2015-01-01")
- .size(2048f)
- .type(Image.Type.HDD)
- .location(Location.US_LAS)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .osType(OsType.LINUX)
- .isPublic(true)
- .isRamHotPlug(true)
- .isRamHotUnPlug(false)
- .isWriteable(true)
- .build()
- );
-
- assertEquals(expected, actual);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandlerTest.java
deleted file mode 100644
index 1bd3518..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandlerTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.ipblock;
-
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.IpBlock;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.domain.IpBlock.PublicIp;
-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 = "IpBlockListResponseHandlerTest")
-public class IpBlockListResponseHandlerTest extends BaseResponseHandlerTest<List<IpBlock>> {
-
- @Override
- protected ParseSax<List<IpBlock>> createParser() {
- return factory.create(injector.getInstance(IpBlockListResponseHandler.class));
- }
-
- @Test
- public void testParseResponseFromGetAllIpBlock() {
- ParseSax<List<IpBlock>> parser = createParser();
-
- List<IpBlock> actual = parser.parse(payloadFromResource("/ipblock/ipblocks.xml"));
- assertNotNull(actual, "Parsed content returned null");
-
- List<IpBlock> expected = ImmutableList.<IpBlock>of(
- IpBlock.builder()
- .id("block-id-1")
- .location(Location.US_LAS)
- .publicIps(ImmutableList.<PublicIp>of(
- PublicIp.builder()
- .ip("10.0.0.2")
- .nicId("nic-id-1")
- .build(),
- PublicIp.builder()
- .ip("10.0.0.3")
- .nicId("nic-id-2")
- .build()))
- .build(),
- IpBlock.builder()
- .id("block-id-2")
- .location(Location.US_LAS)
- .publicIps(ImmutableList.<PublicIp>of(
- PublicIp.builder()
- .ip("10.0.0.4")
- .build(),
- PublicIp.builder()
- .ip("10.0.0.5")
- .nicId("nic-id-4")
- .build()))
- .build()
- );
-
- assertEquals(actual, expected);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandlerTest.java
deleted file mode 100644
index 053f0ae..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandlerTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.ipblock;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import java.util.List;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.IpBlock;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.domain.IpBlock.PublicIp;
-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 = "IpBlockResponseHandlerTest")
-public class IpBlockResponseHandlerTest extends BaseResponseHandlerTest<IpBlock> {
-
- @Override
- protected ParseSax<IpBlock> createParser() {
- return factory.create(injector.getInstance(IpBlockResponseHandler.class));
- }
-
- @Test
- public void testParseResponseFromGetIpBlock() {
- ParseSax<IpBlock> parser = createParser();
-
- IpBlock actual = parser.parse(payloadFromResource("/ipblock/ipblock.xml"));
- assertNotNull(actual, "Parsed content returned null");
- List<String> emptyIpList = Lists.newArrayList();
-
- IpBlock expected = IpBlock.builder()
- .id("qwertyui-qwer-qwer-qwer-qwertyyuiiop")
- .location(Location.US_LAS)
- .publicIps(ImmutableList.<PublicIp>of(
- PublicIp.builder()
- .ip("10.0.0.2")
- .nicId("nic-id")
- .build(),
- PublicIp.builder()
- .ip("10.0.0.3")
- .build()))
- .ips(emptyIpList)
- .build();
- assertEquals(actual, expected);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerIdOnlyResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerIdOnlyResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerIdOnlyResponseHandlerTest.java
deleted file mode 100644
index 9aa18ef..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerIdOnlyResponseHandlerTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertEquals;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "LoadBalancerIdOnlyResponseHandlerTest")
-public class LoadBalancerIdOnlyResponseHandlerTest extends BaseResponseHandlerTest<String> {
-
- @Override
- protected ParseSax<String> createParser() {
- return factory.create(injector.getInstance(LoadBalancerIdOnlyResponseHandler.class));
- }
-
- @Test
- public void testParseResponseFromCreateLoadBalancer() {
- ParseSax<String> parser = createParser();
-
- String loadBalancerId = parser.parse(payloadFromResource("/loadbalancer/loadbalancer-create.xml"));
-
- assertEquals("1234-1234-1234-1234", loadBalancerId);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 3c9e082..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerListResponseHandlerTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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.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.jclouds.date.DateService;
-import org.jclouds.profitbricks.domain.DataCenter;
-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 DateService createDateParser() {
- return injector.getInstance(DateService.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");
-
- DateService dateParser = createDateParser();
-
- List<LoadBalancer> expected = ImmutableList.<LoadBalancer>of(
- LoadBalancer.builder()
- .id("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
- .algorithm(Algorithm.ROUND_ROBIN)
- .name("load-1234567890-name")
- .dataCenter(DataCenter.builder()
- .id("datacenter-id")
- .version(4)
- .build())
- .internetAccess(true)
- .ip("192.168.0.1")
- .lanId(1)
- .state(ProvisioningState.AVAILABLE)
- .creationTime(dateParser.iso8601DateOrSecondsDateParse("2014-12-04T07:09:23.138Z"))
- .lastModificationTime(dateParser.iso8601DateOrSecondsDateParse("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()
- .loadBalanced(true)
- .balancedNicId("balanced-nic-id")
- .id("server-id")
- .name("server-name")
- .build()
- )).build(),
- LoadBalancer.builder()
- .id("qqqqqqqq-wwww-rrrr-tttt-yyyyyyyyyyyy")
- .algorithm(Algorithm.ROUND_ROBIN)
- .name("load-balancer-name")
- .dataCenter(DataCenter.builder()
- .id("datacenter-id")
- .version(4)
- .build())
- .internetAccess(false)
- .ip("192.168.0.1")
- .lanId(2)
- .state(ProvisioningState.AVAILABLE)
- .creationTime(dateParser.iso8601DateOrSecondsDateParse("2014-12-04T07:09:23.138Z"))
- .lastModificationTime(dateParser.iso8601DateOrSecondsDateParse("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()
- .loadBalanced(false)
- .balancedNicId("balanced-nic-id")
- .id("server-id")
- .name("server-name")
- .build()
- ))
- .build()
- );
- assertEquals(actual, expected);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 0971e21..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerResponseHandlerTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.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.jclouds.date.DateService;
-import org.jclouds.profitbricks.domain.DataCenter;
-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 DateService createDateParser() {
- return injector.getInstance(DateService.class);
- }
-
- @Test
- public void testParseResponseFromGetLoadbalancer() {
- ParseSax<LoadBalancer> parser = createParser();
-
- LoadBalancer actual = parser.parse(payloadFromResource("/loadbalancer/loadbalancer.xml"));
- assertNotNull(actual, "Parsed content returned null");
-
- DateService dateParser = createDateParser();
-
- List<Storage> emptyStorages = Lists.newArrayList();
-
- List<Server> balancedServers = Lists.newArrayList();
- balancedServers.add(Server.builder()
- .loadBalanced(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")
- .algorithm(Algorithm.ROUND_ROBIN)
- .name("load-balancer-name")
- .dataCenter(DataCenter.builder()
- .id("datacenter-id")
- .version(4)
- .build())
- .internetAccess(true)
- .ip("192.168.0.1")
- .lanId(2)
- .state(ProvisioningState.AVAILABLE)
- .creationTime(dateParser.iso8601DateOrSecondsDateParse("2014-12-12T03:08:35.629Z"))
- .lastModificationTime(dateParser.iso8601DateOrSecondsDateParse("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/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/nic/NicIdOnlyResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/nic/NicIdOnlyResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/nic/NicIdOnlyResponseHandlerTest.java
deleted file mode 100644
index 23b9c4c..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/nic/NicIdOnlyResponseHandlerTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.nic;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "NicIdOnlyResponseHandlerTest")
-public class NicIdOnlyResponseHandlerTest extends BaseResponseHandlerTest<String> {
-
- @Override
- protected ParseSax<String> createParser() {
- return factory.create(injector.getInstance(NicIdOnlyResponseHandler.class));
- }
-
- @Test
- public void testParseResponseFromCreateNic() {
- ParseSax<String> parser = createParser();
- String nicId = parser.parse(payloadFromResource("/nic/nic-create.xml"));
- assertEquals("nic-id", nicId);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/nic/NicListResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/nic/NicListResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/nic/NicListResponseHandlerTest.java
deleted file mode 100644
index aa1975d..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/nic/NicListResponseHandlerTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.nic;
-
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.Firewall;
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-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 = "NicListResponseHandlerTest")
-public class NicListResponseHandlerTest extends BaseResponseHandlerTest<List<Nic>> {
-
- @Override
- protected ParseSax<List<Nic>> createParser() {
- return factory.create(injector.getInstance(NicListResponseHandler.class));
- }
-
- @Test
- public void testParseResponseFromGetAllNic() {
- ParseSax<List<Nic>> parser = createParser();
- List<Nic> actual = parser.parse(payloadFromResource("/nic/nics.xml"));
- assertNotNull(actual, "Parsed content returned null");
-
- List<Nic> expected = ImmutableList.of(
- Nic.builder()
- .dataCenterId("datacenter-id")
- .id("nic-id")
- .name("nic-name")
- .lanId(1)
- .internetAccess(true)
- .serverId("server-id")
- .ips(ImmutableList.of("192.168.0.1"))
- .macAddress("aa:bb:cc:dd:ee:f1")
- .firewall(
- Firewall.builder()
- .active(true)
- .id("firewall-id")
- .nicId("nic-id")
- .state(ProvisioningState.AVAILABLE)
- .build()
- )
- .dhcpActive(true)
- .gatewayIp("192.168.0.0")
- .state(ProvisioningState.AVAILABLE)
- .build(),
- Nic.builder()
- .dataCenterId("datacenter-id")
- .id("nic-id2")
- .name("nick")
- .lanId(1)
- .internetAccess(false)
- .serverId("server-id")
- .ips(ImmutableList.of(
- "192.168.0.2",
- "192.168.0.3",
- "192.168.0.4"
- ))
- .macAddress("aa:bb:cc:dd:ee:f2")
- .firewall(
- Firewall.builder()
- .active(false)
- .id("firewall-id2")
- .nicId("nic-id")
- .state(ProvisioningState.AVAILABLE)
- .build()
- )
- .dhcpActive(false)
- .gatewayIp("192.168.0.0")
- .state(ProvisioningState.AVAILABLE)
- .build()
- );
-
- assertEquals(actual, expected);
- }
-}
[07/11] jclouds-labs git commit: Remove ProfitBricks
Posted by de...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandler.java
deleted file mode 100644
index 3ef85b3..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandler.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.ipblock;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.domain.IpBlock;
-import org.jclouds.profitbricks.http.parser.publicip.PublicIpListResponseHandler;
-import org.xml.sax.SAXException;
-
-import com.google.inject.Inject;
-import com.google.common.collect.Lists;
-
-public class IpBlockListResponseHandler extends BaseIpBlockResponseHandler<List<IpBlock>> {
-
- private final List<IpBlock> ipBlocks;
-
- @Inject
- IpBlockListResponseHandler(PublicIpListResponseHandler publicIpListResponseHandler) {
- super(publicIpListResponseHandler);
- ipBlocks = Lists.newArrayList();
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- if (usePublicIpListParser)
- publicIpListResponseHandler.endElement(uri, localName, qName);
- else {
- setPropertyOnEndTag(qName);
- if ("return".equals(qName)) {
- ipBlocks.add(builder
- .publicIps(publicIpListResponseHandler.getResult())
- .build());
- publicIpListResponseHandler.reset();
- builder = IpBlock.builder();
- }
- clearTextBuffer();
- }
-
- if ("publicIps".equals(qName))
- usePublicIpListParser = false;
-
- }
-
- @Override
- public List<IpBlock> getResult() {
- return ipBlocks;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandler.java
deleted file mode 100644
index 95bc81a..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandler.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.ipblock;
-
-import com.google.inject.Inject;
-import org.jclouds.profitbricks.domain.IpBlock;
-import org.jclouds.profitbricks.http.parser.publicip.PublicIpListResponseHandler;
-import org.xml.sax.SAXException;
-
-public class IpBlockResponseHandler extends BaseIpBlockResponseHandler<IpBlock> {
-
- private boolean done = false;
-
- @Inject
- IpBlockResponseHandler(PublicIpListResponseHandler publicIpListResponseHandler) {
- super(publicIpListResponseHandler);
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- if (done)
- return;
-
- if (usePublicIpListParser)
- publicIpListResponseHandler.endElement(uri, localName, qName);
- else {
- setPropertyOnEndTag(qName);
- if ("return".equals(qName)) {
- done = true;
- builder.publicIps(publicIpListResponseHandler.getResult())
- .ips(ips);
- }
- clearTextBuffer();
- }
-
- if ("publicIps".equals(qName))
- usePublicIpListParser = false;
- }
-
- @Override
- public void reset() {
- this.builder = IpBlock.builder();
- }
-
- @Override
- public IpBlock getResult() {
- return builder.build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index b796125..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/BaseLoadBalancerResponseHandler.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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 static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Date;
-
-import org.jclouds.date.DateService;
-import org.jclouds.profitbricks.domain.DataCenter;
-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 DataCenter.Builder dataCenterBuilder;
-
- protected final DateService dateService;
-
- protected boolean useBalancedServerParser = false;
- protected boolean useFirewallParser = false;
-
- protected BaseLoadBalancerResponseHandler(DateService dateService,
- ServerListResponseHandler balancedServerResponseHandler, FirewallListResponseHandler firewallResponseHandler) {
-
- checkNotNull(dateService, "DateService cannot be null");
- checkNotNull(balancedServerResponseHandler, "BalancedServerResponseHandler cannot be null");
- checkNotNull(firewallResponseHandler, "FirewallListResponseHandler cannot be null");
-
- this.dateService = dateService;
- this.builder = LoadBalancer.builder();
- this.dataCenterBuilder = DataCenter.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 dateService.iso8601DateOrSecondsDateParse(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.algorithm(Algorithm.fromValue(textToStringValue()));
- else if ("dataCenterId".equals(qName))
- dataCenterBuilder.id(textToStringValue());
- else if ("dataCenterVersion".equals(qName))
- dataCenterBuilder.version(textToIntValue());
- else if ("internetAccess".equals(qName))
- builder.internetAccess(textToBooleanValue());
- else if ("ip".equals(qName))
- builder.ip(textToStringValue());
- else if ("lanId".equals(qName))
- builder.lanId(textToIntValue());
- 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/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerIdOnlyResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerIdOnlyResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerIdOnlyResponseHandler.java
deleted file mode 100644
index a239336..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerIdOnlyResponseHandler.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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 org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
-import org.xml.sax.SAXException;
-
-/**
- * Handler for parsing SOAP response where <i>loadBalancerId</i> is the only <i>usable</i> value.
- *
- * Other properties available (which are ignored): requestId, dataCenterId, dataCenterVersion
- */
-public class LoadBalancerIdOnlyResponseHandler extends BaseProfitBricksResponseHandler<String> {
-
- private String loadBalancerId;
-
- LoadBalancerIdOnlyResponseHandler() {
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- setPropertyOnEndTag(qName);
- clearTextBuffer();
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("loadBalancerId".equals(qName))
- loadBalancerId = textToStringValue();
- }
-
- @Override
- public String getResult() {
- return loadBalancerId;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 9c60d33..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerListResponseHandler.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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 com.google.inject.Inject;
-
-import java.util.List;
-
-import org.jclouds.date.DateService;
-import org.jclouds.profitbricks.domain.DataCenter;
-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(DateService dateService, ServerListResponseHandler balancedServerResponseHandler, FirewallListResponseHandler firewallListResponseHandler) {
- super(dateService, 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
- .dataCenter(dataCenterBuilder.build())
- .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 void reset() {
- this.dataCenterBuilder = DataCenter.builder();
- }
-
- @Override
- public List<LoadBalancer> getResult() {
- return loadBalancers;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 4a17535..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerResponseHandler.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.DateService;
-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(DateService dateService, ServerListResponseHandler serverListResponseHandler,
- FirewallListResponseHandler firewallListResponseHandler) {
- super(dateService, 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.dataCenter(dataCenterBuilder.build())
- .balancedServers(balancedServerResponseHandler.getResult())
- .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/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/BaseNicResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/BaseNicResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/BaseNicResponseHandler.java
deleted file mode 100644
index 0b4b537..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/BaseNicResponseHandler.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.nic;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.google.inject.Inject;
-
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
-import org.jclouds.profitbricks.http.parser.firewall.FirewallResponseHandler;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-public abstract class BaseNicResponseHandler<T> extends BaseProfitBricksResponseHandler<T> {
-
- protected final FirewallResponseHandler firewallResponseHandler;
-
- protected boolean useFirewallParser = false;
- protected Nic.Builder builder;
- protected List<String> ips;
-
- @Inject
- BaseNicResponseHandler(FirewallResponseHandler firewallResponseHandler) {
- this.builder = Nic.builder();
- this.firewallResponseHandler = firewallResponseHandler;
- this.ips = new ArrayList<String>();
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
- if ("firewall".equals(qName))
- useFirewallParser = true;
- if (useFirewallParser)
- firewallResponseHandler.startElement(uri, localName, qName, attributes);
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- if (useFirewallParser)
- firewallResponseHandler.characters(ch, start, length);
- else
- super.characters(ch, start, length);
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("dataCenterId".equals(qName))
- builder.dataCenterId(textToStringValue());
- else if ("nicName".equals(qName))
- builder.name(textToStringValue());
- else if ("nicId".equals(qName))
- builder.id(textToStringValue());
- else if ("lanId".equals(qName))
- builder.lanId(textToIntValue());
- else if ("internetAccess".equals(qName))
- builder.internetAccess(textToBooleanValue());
- else if ("serverId".equals(qName))
- builder.serverId(textToStringValue());
- else if ("ips".equals(qName))
- ips.add(textToStringValue());
- else if ("macAddress".equals(qName))
- builder.macAddress(textToStringValue());
- else if ("dhcpActive".equals(qName))
- builder.dhcpActive(textToBooleanValue());
- else if ("gatewayIp".equals(qName))
- builder.gatewayIp(textToStringValue());
- else if ("provisioningState".equals(qName))
- builder.state(ProvisioningState.fromValue(textToStringValue()));
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/NicIdOnlyResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/NicIdOnlyResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/NicIdOnlyResponseHandler.java
deleted file mode 100644
index 8f8ba03..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/NicIdOnlyResponseHandler.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.nic;
-
-import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
-import org.xml.sax.SAXException;
-
-/**
- * Handler for parsing SOAP response where <i>nicId</i> is the only <i>usable</i> value.
- *
- * Other properties available (which are ignored): requestId, dataCenterId, dataCenterVersion
- */
-public class NicIdOnlyResponseHandler extends BaseProfitBricksResponseHandler<String> {
-
- private String nicId;
-
- NicIdOnlyResponseHandler() {
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- setPropertyOnEndTag(qName);
- clearTextBuffer();
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("nicId".equals(qName))
- nicId = textToStringValue();
- }
-
- @Override
- public String getResult() {
- return nicId;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/NicListResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/NicListResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/NicListResponseHandler.java
deleted file mode 100644
index 87e7f43..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/NicListResponseHandler.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.nic;
-
-import java.util.ArrayList;
-
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-
-import org.jclouds.profitbricks.domain.Nic;
-import org.xml.sax.SAXException;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.http.parser.firewall.FirewallResponseHandler;
-
-public class NicListResponseHandler extends BaseNicResponseHandler<List<Nic>> {
-
- private List<Nic> nics;
-
- @Inject
- public NicListResponseHandler(FirewallResponseHandler firewallResponseHandler) {
- super(firewallResponseHandler);
- this.nics = Lists.newArrayList();
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- if (useFirewallParser)
- firewallResponseHandler.endElement(uri, localName, qName);
- else {
- setPropertyOnEndTag(qName);
- if ("return".equals(qName) || "nics".equals(qName)) {
- nics.add(builder
- .ips(ips)
- .firewall(firewallResponseHandler.getResult())
- .build());
- builder = Nic.builder();
- ips = new ArrayList<String>();
- firewallResponseHandler.reset();
- }
- clearTextBuffer();
- }
-
- if ("firewall".equals(qName))
- useFirewallParser = false;
- }
-
- @Override
- public void reset() {
- this.ips = new ArrayList<String>();
- this.nics = Lists.newArrayList();
- }
-
- @Override
- public List<Nic> getResult() {
- return nics;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/NicResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/NicResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/NicResponseHandler.java
deleted file mode 100644
index ec4dd10..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/NicResponseHandler.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.nic;
-
-import java.util.ArrayList;
-
-import com.google.inject.Inject;
-
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.http.parser.firewall.FirewallResponseHandler;
-import org.xml.sax.SAXException;
-
-public class NicResponseHandler extends BaseNicResponseHandler<Nic> {
-
- private boolean done = false;
-
- @Inject
- public NicResponseHandler(FirewallResponseHandler firewallResponseHandler) {
- super(firewallResponseHandler);
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- if (done)
- return;
-
- if (useFirewallParser)
- firewallResponseHandler.endElement(uri, localName, qName);
- else {
- setPropertyOnEndTag(qName);
- if ("return".equals(qName)) {
- done = true;
- builder.ips(ips)
- .firewall(firewallResponseHandler.getResult());
- ips = new ArrayList<String>();
- firewallResponseHandler.reset();
- }
- clearTextBuffer();
- }
-
- if ("firewall".equals(qName))
- useFirewallParser = false;
- }
-
- @Override
- public Nic getResult() {
- return builder.build();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/BasePublicIpResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/BasePublicIpResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/BasePublicIpResponseHandler.java
deleted file mode 100644
index 8561aad..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/BasePublicIpResponseHandler.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.publicip;
-
-import org.jclouds.profitbricks.domain.IpBlock;
-import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
-
-public abstract class BasePublicIpResponseHandler<T> extends BaseProfitBricksResponseHandler<T> {
-
- protected IpBlock.PublicIp.Builder builder;
-
- BasePublicIpResponseHandler() {
- this.builder = IpBlock.PublicIp.builder();
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("ip".equals(qName))
- builder.ip(textToStringValue());
- else if ("nicId".equals(qName))
- builder.nicId(textToStringValue());
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/PublicIpListResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/PublicIpListResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/PublicIpListResponseHandler.java
deleted file mode 100644
index 8b01be9..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/PublicIpListResponseHandler.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.publicip;
-
-import com.google.common.collect.Lists;
-import java.util.List;
-import org.jclouds.profitbricks.domain.IpBlock.PublicIp;
-import org.xml.sax.SAXException;
-
-public class PublicIpListResponseHandler extends BasePublicIpResponseHandler<List<PublicIp>> {
-
- private List<PublicIp> publicIps;
-
- PublicIpListResponseHandler() {
- this.publicIps = Lists.newArrayList();
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- setPropertyOnEndTag(qName);
-
- if ("publicIps".equals(qName)){
- publicIps.add(builder.build());
- this.builder = PublicIp.builder();
- }
- clearTextBuffer();
- }
-
- @Override
- public void reset() {
- this.publicIps = Lists.newArrayList();
- }
-
- @Override
- public List<PublicIp> getResult() {
- return publicIps;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 2185aed..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/BaseServerResponseHandler.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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.server;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Date;
-
-import org.jclouds.date.DateService;
-import org.jclouds.profitbricks.domain.AvailabilityZone;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.domain.Server;
-import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
-import org.jclouds.profitbricks.http.parser.nic.NicListResponseHandler;
-import org.jclouds.profitbricks.http.parser.storage.StorageListResponseHandler;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-public abstract class BaseServerResponseHandler<T> extends BaseProfitBricksResponseHandler<T> {
-
- protected final StorageListResponseHandler storageListResponseHandler;
- protected final NicListResponseHandler nicListResponseHandler;
-
- protected DataCenter.Builder dataCenterBuilder;
- protected Server.Builder builder;
-
- protected final DateService dateService;
-
- protected boolean useStorageParser = false;
- protected boolean useNicParser = false;
-
- BaseServerResponseHandler(DateService dateService, StorageListResponseHandler storageListResponseHandler,
- NicListResponseHandler nicListResponseHandler) {
- checkNotNull(dateService, "DateService cannot be null");
- checkNotNull(storageListResponseHandler, "StorageListResponseHandler cannot be null");
- checkNotNull(nicListResponseHandler, "NicListResponseHandler cannot be null");
-
- this.dateService = dateService;
- this.storageListResponseHandler = storageListResponseHandler;
- this.nicListResponseHandler = nicListResponseHandler;
- this.builder = Server.builder();
- this.dataCenterBuilder = DataCenter.builder();
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
- if ("connectedStorages".equals(qName))
- useStorageParser = true;
- else if ("nics".equals(qName))
- useNicParser = true;
-
- if (useStorageParser)
- storageListResponseHandler.startElement(uri, localName, qName, attributes);
- else if (useNicParser)
- nicListResponseHandler.startElement(uri, localName, qName, attributes);
- else
- super.startElement(uri, localName, qName, attributes);
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- if (useStorageParser)
- storageListResponseHandler.characters(ch, start, length);
- else if (useNicParser)
- nicListResponseHandler.characters(ch, start, length);
- else
- super.characters(ch, start, length);
- }
-
- protected final Date textToIso8601Date() {
- return dateService.iso8601DateOrSecondsDateParse(textToStringValue());
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("dataCenterId".equals(qName))
- dataCenterBuilder.id(textToStringValue());
- else if ("dataCenterVersion".equals(qName))
- dataCenterBuilder.version(textToIntValue());
- else if ("serverId".equals(qName))
- builder.id(textToStringValue());
- else if ("serverName".equals(qName))
- builder.name(textToStringValue());
- else if ("cores".equals(qName))
- builder.cores(textToIntValue());
- else if ("ram".equals(qName))
- builder.ram(textToIntValue());
- else if ("provisioningState".equals(qName))
- builder.state(ProvisioningState.fromValue(textToStringValue()));
- else if ("virtualMachineState".equals(qName))
- builder.status(Server.Status.fromValue(textToStringValue()));
- else if ("osType".equals(qName))
- builder.osType(OsType.fromValue(textToStringValue()));
- else if ("availabilityZone".equals(qName))
- builder.availabilityZone(AvailabilityZone.fromValue(textToStringValue()));
- else if ("creationTime".equals(qName))
- builder.creationTime(textToIso8601Date());
- else if ("lastModificationTime".equals(qName))
- builder.lastModificationTime(textToIso8601Date());
- else if ("internetAccess".equals(qName))
- builder.hasInternetAccess(textToBooleanValue());
- else if ("cpuHotPlug".equals(qName))
- builder.isCpuHotPlug(textToBooleanValue());
- else if ("ramHotPlug".equals(qName))
- builder.isRamHotPlug(textToBooleanValue());
- else if ("nicHotPlug".equals(qName))
- builder.isNicHotPlug(textToBooleanValue());
- else if ("nicHotUnPlug".equals(qName))
- builder.isNicHotUnPlug(textToBooleanValue());
- else if ("discVirtioHotPlug".equals(qName))
- builder.isDiscVirtioHotPlug(textToBooleanValue());
- else if ("discVirtioHotUnPlug".equals(qName))
- builder.isDiscVirtioHotUnPlug(textToBooleanValue());
- else if ("activate".equals(qName))
- builder.loadBalanced(textToBooleanValue());
- else if ("balancedNicId".equals(qName))
- builder.balancedNicId(textToStringValue());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/ServerIdOnlyResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/ServerIdOnlyResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/ServerIdOnlyResponseHandler.java
deleted file mode 100644
index 1c74354..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/ServerIdOnlyResponseHandler.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.server;
-
-import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
-import org.xml.sax.SAXException;
-
-/**
- * Handler for parsing SOAP response where <i>serverId</i> is the only <i>usable</i> value.
- *
- * Other properties available (which are ignored): requestId, dataCenterId, dataCenterVersion
- */
-public class ServerIdOnlyResponseHandler extends BaseProfitBricksResponseHandler<String> {
-
- private String serverId;
-
- ServerIdOnlyResponseHandler() {
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- setPropertyOnEndTag(qName);
- clearTextBuffer();
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("serverId".equals(qName))
- serverId = textToStringValue();
- }
-
- @Override
- public String getResult() {
- return serverId;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/ServerInfoResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/ServerInfoResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/ServerInfoResponseHandler.java
deleted file mode 100644
index 016e164..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/ServerInfoResponseHandler.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.server;
-
-import com.google.inject.Inject;
-
-import org.jclouds.date.DateService;
-import org.jclouds.profitbricks.domain.Server;
-import org.jclouds.profitbricks.http.parser.nic.NicListResponseHandler;
-import org.jclouds.profitbricks.http.parser.storage.StorageListResponseHandler;
-import org.xml.sax.SAXException;
-
-public class ServerInfoResponseHandler extends BaseServerResponseHandler<Server> {
-
- private boolean done = false;
-
- @Inject
- ServerInfoResponseHandler(DateService dateService, StorageListResponseHandler storageListResponseHandler,
- NicListResponseHandler nicListResponseHandler) {
- super(dateService, storageListResponseHandler, nicListResponseHandler);
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- if (done)
- return;
-
- if (useStorageParser)
- storageListResponseHandler.endElement(uri, localName, qName);
- else if (useNicParser)
- nicListResponseHandler.endElement(uri, localName, qName);
- else {
- setPropertyOnEndTag(qName);
- if ("return".equals(qName)) {
- done = true;
- builder
- .dataCenter(dataCenterBuilder.build())
- .storages(storageListResponseHandler.getResult())
- .nics(nicListResponseHandler.getResult());
- }
- clearTextBuffer();
- }
-
- if ("connectedStorages".equals(qName))
- useStorageParser = false;
- else if ("nics".equals(qName))
- useNicParser = false;
- }
-
- @Override
- public Server getResult() {
- return builder.build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index d39fbad..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/ServerListResponseHandler.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.server;
-
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-
-import java.util.List;
-
-import org.jclouds.date.DateService;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Server;
-import org.jclouds.profitbricks.http.parser.nic.NicListResponseHandler;
-import org.jclouds.profitbricks.http.parser.storage.StorageListResponseHandler;
-import org.xml.sax.SAXException;
-
-public class ServerListResponseHandler extends BaseServerResponseHandler<List<Server>> {
-
- private List<Server> servers;
-
- @Inject
- ServerListResponseHandler(DateService dateService, StorageListResponseHandler storageListResponseHandler,
- NicListResponseHandler nicListResponseHandler) {
- super(dateService, storageListResponseHandler, nicListResponseHandler);
- this.servers = Lists.newArrayList();
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
-
- if (useStorageParser)
- storageListResponseHandler.endElement(uri, localName, qName);
- else if (useNicParser)
- nicListResponseHandler.endElement(uri, localName, qName);
- else {
- setPropertyOnEndTag(qName);
- if ("return".equals(qName) || "servers".equals(qName) || "balancedServers".equals(qName)) {
- Server.Builder sdb = null;
- try {
- sdb = builder
- .storages(storageListResponseHandler.getResult())
- .nics(nicListResponseHandler.getResult());
- servers.add(sdb
- // For LoadBalancer's case, there's no DataCenter (may throw NPE on #build()).
- .dataCenter(dataCenterBuilder.build())
- .build());
- } catch (Exception ex) {
- servers.add(sdb.build());
- }
- storageListResponseHandler.reset();
- nicListResponseHandler.reset();
-
- builder = Server.builder();
- }
- clearTextBuffer();
- }
-
- if ("connectedStorages".equals(qName))
- useStorageParser = false;
- else if ("nics".equals(qName))
- useNicParser = false;
- }
-
- @Override
- public void reset() {
- this.servers = Lists.newArrayList();
- this.dataCenterBuilder = DataCenter.builder();
- }
-
- @Override
- public List<Server> getResult() {
- return servers;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/snapshot/BaseSnapshotResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/snapshot/BaseSnapshotResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/snapshot/BaseSnapshotResponseHandler.java
deleted file mode 100644
index aa27199..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/snapshot/BaseSnapshotResponseHandler.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.snapshot;
-
-import java.util.Date;
-
-import org.jclouds.date.DateService;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
-
-public abstract class BaseSnapshotResponseHandler<T> extends BaseProfitBricksResponseHandler<T> {
-
- protected Snapshot.Builder builder;
-
- protected final DateService dateService;
-
- BaseSnapshotResponseHandler(DateService dateService) {
- this.dateService = dateService;
- this.builder = Snapshot.builder();
- }
-
- protected final Date textToIso8601Date() {
- return dateService.iso8601DateOrSecondsDateParse(textToStringValue());
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("snapshotId".equals(qName))
- builder.id(textToStringValue());
- else if ("snapshotName".equals(qName))
- builder.name(textToStringValue());
- else if ("snapshotSize".equals(qName))
- builder.size(textToFloatValue());
- else if ("osType".equals(qName))
- builder.osType(OsType.fromValue(textToStringValue()));
- else if ("location".equals(qName))
- builder.location(Location.fromId(textToStringValue()));
- else if ("description".equals(qName))
- builder.description(qName);
- else if ("bootable".equals(qName))
- builder.isBootable(textToBooleanValue());
- else if ("cpuHotPlug".equals(qName))
- builder.isCpuHotPlug(textToBooleanValue());
- else if ("cpuHotUnPlug".equals(qName))
- builder.isCpuHotUnPlug(textToBooleanValue());
- else if ("ramHotPlug".equals(qName))
- builder.isRamHotPlug(textToBooleanValue());
- else if ("ramHotUnPlug".equals(qName))
- builder.isRamHotUnPlug(textToBooleanValue());
- else if ("nicHotPlug".equals(qName))
- builder.isNicHotPlug(textToBooleanValue());
- else if ("nicHotUnPlug".equals(qName))
- builder.isNicHotUnPlug(textToBooleanValue());
- else if ("discVirtioHotPlug".equals(qName))
- builder.isDiscVirtioHotPlug(textToBooleanValue());
- else if ("discVirtioHotUnPlug".equals(qName))
- builder.isDiscVirtioHotUnPlug(textToBooleanValue());
- else if ("provisioningState".equals(qName))
- builder.state(ProvisioningState.fromValue(textToStringValue()));
- else if ("creationTimestamp".equals(qName))
- builder.creationTime(textToIso8601Date());
- else if ("modificationTimestamp".equals(qName))
- builder.lastModificationTime(textToIso8601Date());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotListResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotListResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotListResponseHandler.java
deleted file mode 100644
index 27e8583..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotListResponseHandler.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.snapshot;
-
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.xml.sax.SAXException;
-
-import java.util.List;
-
-import org.jclouds.date.DateService;
-
-public class SnapshotListResponseHandler extends BaseSnapshotResponseHandler<List<Snapshot>> {
-
- private final List<Snapshot> snapshots;
-
- @Inject
- SnapshotListResponseHandler(DateService dateService) {
- super(dateService);
- this.snapshots = Lists.newArrayList();
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- setPropertyOnEndTag(qName);
- if ("return".equals(qName)) {
- snapshots.add(builder.build());
- builder = Snapshot.builder();
- }
- clearTextBuffer();
- }
-
- @Override
- public List<Snapshot> getResult() {
- return snapshots;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotResponseHandler.java
deleted file mode 100644
index c57e385..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotResponseHandler.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.snapshot;
-
-import com.google.inject.Inject;
-
-import org.jclouds.date.DateService;
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.xml.sax.SAXException;
-
-public class SnapshotResponseHandler extends BaseSnapshotResponseHandler<Snapshot> {
-
- private boolean done = false;
-
- @Inject
- SnapshotResponseHandler(DateService dateService) {
- super(dateService);
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- if (done)
- return;
- setPropertyOnEndTag(qName);
- if ("return".equals(qName))
- done = true;
- clearTextBuffer();
- }
-
- @Override
- public Snapshot getResult() {
- return builder.build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/state/GetProvisioningStateResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/state/GetProvisioningStateResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/state/GetProvisioningStateResponseHandler.java
deleted file mode 100644
index d618cc1..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/state/GetProvisioningStateResponseHandler.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.state;
-
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
-import org.xml.sax.SAXException;
-
-public class GetProvisioningStateResponseHandler extends BaseProfitBricksResponseHandler<ProvisioningState> {
-
- private ProvisioningState state = ProvisioningState.UNRECOGNIZED;
-
- GetProvisioningStateResponseHandler() {
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- setPropertyOnEndTag(qName);
- clearTextBuffer();
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("return".equals(qName))
- state = ProvisioningState.fromValue(textToStringValue());
- }
-
- @Override
- public ProvisioningState getResult() {
- return state;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/BaseStorageResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/BaseStorageResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/BaseStorageResponseHandler.java
deleted file mode 100644
index 9026592..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/BaseStorageResponseHandler.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.storage;
-
-import java.util.Date;
-import java.util.List;
-
-import com.google.inject.Inject;
-
-import org.jclouds.date.DateService;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.domain.Storage;
-import org.jclouds.profitbricks.domain.Storage.BusType;
-import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
-
-import com.google.common.collect.Lists;
-
-public abstract class BaseStorageResponseHandler<T> extends BaseProfitBricksResponseHandler<T> {
-
- protected final DateService dateService;
-
- protected Storage.Builder builder;
- protected List<String> serverIds;
-
- @Inject
- BaseStorageResponseHandler(DateService dateService) {
- this.dateService = dateService;
- this.builder = Storage.builder();
- this.serverIds = Lists.newArrayList();
- }
-
- protected final Date textToIso8601Date() {
- return dateService.iso8601DateOrSecondsDateParse(textToStringValue());
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
-// <requestId>?</requestId>
-// <dataCenterId>?</dataCenterId>
-// <dataCenterVersion>?</dataCenterVersion>
- if ("storageId".equals(qName))
- builder.id(textToStringValue());
- else if ("size".equals(qName))
- builder.size(textToFloatValue());
- else if ("storageName".equals(qName))
- builder.name(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());
-// <mountImage>
-// <imageId>?</imageId>
-// <imageName>?</imageName>
-// </mountImage>
- else if ("serverIds".equals(qName))
- serverIds.add(textToStringValue());
- else if ("bootDevice".equals(qName))
- builder.bootDevice(textToBooleanValue());
- else if ("busType".equals(qName))
- builder.busType(BusType.fromValue(textToStringValue()));
- else if ("deviceNumber".equals(qName))
- builder.deviceNumber(textToIntValue());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/StorageIdOnlyResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/StorageIdOnlyResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/StorageIdOnlyResponseHandler.java
deleted file mode 100644
index ac3a039..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/StorageIdOnlyResponseHandler.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.storage;
-
-import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
-import org.xml.sax.SAXException;
-
-public class StorageIdOnlyResponseHandler extends BaseProfitBricksResponseHandler<String> {
-
- private String storageId;
-
- StorageIdOnlyResponseHandler() {
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- setPropertyOnEndTag(qName);
- clearTextBuffer();
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("storageId".equals(qName))
- storageId = textToStringValue();
- }
-
- @Override
- public String getResult() {
- return storageId;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/StorageInfoResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/StorageInfoResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/StorageInfoResponseHandler.java
deleted file mode 100644
index ae667ca..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/StorageInfoResponseHandler.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.storage;
-
-import com.google.inject.Inject;
-
-import org.jclouds.date.DateService;
-import org.jclouds.profitbricks.domain.Storage;
-import org.xml.sax.SAXException;
-
-public class StorageInfoResponseHandler extends BaseStorageResponseHandler<Storage> {
-
- private boolean done = false;
-
- @Inject
- StorageInfoResponseHandler(DateService dateService) {
- super(dateService);
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- if (done)
- return;
- setPropertyOnEndTag(qName);
- if ("return".equals(qName)) {
- done = true;
- builder.serverIds(serverIds);
- }
- clearTextBuffer();
- }
-
- @Override
- public Storage getResult() {
- return builder.build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/StorageListResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/StorageListResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/StorageListResponseHandler.java
deleted file mode 100644
index 3048f66..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/storage/StorageListResponseHandler.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.storage;
-
-import java.util.List;
-
-import org.jclouds.date.DateService;
-import org.jclouds.profitbricks.domain.Storage;
-import org.xml.sax.SAXException;
-
-import com.google.inject.Inject;
-import com.google.common.collect.Lists;
-
-public class StorageListResponseHandler extends BaseStorageResponseHandler<List<Storage>> {
-
- private List<Storage> storages;
-
- @Inject
- StorageListResponseHandler(DateService dateService) {
- super(dateService);
- this.storages = Lists.newArrayList();
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- setPropertyOnEndTag(qName);
- if ("return".equals(qName) || "connectedStorages".equals(qName) || "storages".equals(qName)) {
- storages.add(builder
- .serverIds(serverIds)
- .build());
- builder = Storage.builder();
- serverIds = Lists.newArrayList();
- }
- clearTextBuffer();
- }
-
- @Override
- public void reset() {
- this.storages = Lists.newArrayList();
- }
-
- @Override
- public List<Storage> getResult() {
- return storages;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/util/MacAddresses.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/util/MacAddresses.java b/profitbricks/src/main/java/org/jclouds/profitbricks/util/MacAddresses.java
deleted file mode 100644
index 5725e4b..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/util/MacAddresses.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.util;
-
-import java.util.regex.Pattern;
-
-public class MacAddresses {
-
- private static final String MAC_ADDR_FORMAT = "^([0-9a-f]{2}[:]){5}([0-9a-f]{2})$";
- private static final Pattern MAC_ADDR_PATTERN = Pattern.compile(MAC_ADDR_FORMAT);
-
- public static boolean isMacAddress(String in) {
- return MAC_ADDR_PATTERN.matcher(in).matches();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/util/Passwords.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/util/Passwords.java b/profitbricks/src/main/java/org/jclouds/profitbricks/util/Passwords.java
deleted file mode 100644
index 338f064..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/util/Passwords.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.util;
-
-import java.util.Random;
-import java.util.regex.Pattern;
-
-import com.google.common.collect.ImmutableSet;
-
-public class Passwords {
-
- private static final Random random = new Random();
-
- private static final int MIN_CHAR = 8;
- private static final int MAX_CHAR = 50;
- private static final String PASSWORD_FORMAT = String.format(
- "[a-zA-Z0-9][^iIloOwWyYzZ10]{%d,%d}", MIN_CHAR - 1, MAX_CHAR);
- private static final Pattern PASSWORD_PATTERN = Pattern.compile(PASSWORD_FORMAT);
-
- private static final ImmutableSet<Character> INVALID_CHARS = ImmutableSet.<Character>of(
- 'i', 'I', 'l', 'o', 'O', 'w', 'W', 'y', 'Y', 'z', 'Z', '1', '0');
-
- public static boolean isValidPassword(String password) {
- return PASSWORD_PATTERN.matcher(password).matches();
- }
-
- public static String generate() {
- int count = random.nextInt(MAX_CHAR - MIN_CHAR) + MIN_CHAR;
-
- final char[] buffer = new char[count];
-
- final int start = 'A';
- final int end = 'z';
- final int gap = end - start + 1;
-
- while (count-- != 0) {
- char ch = (char) (random.nextInt(gap) + start);
- if ((isBetween(ch, start, 'Z') || isBetween(ch, 'a', end))
- && !INVALID_CHARS.contains(ch))
- buffer[count] = ch;
- else
- count++;
- }
- return new String(buffer);
- }
-
- private static boolean isBetween(char ch, int start, int end) {
- return ch >= start && ch <= end;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/util/Preconditions.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/util/Preconditions.java b/profitbricks/src/main/java/org/jclouds/profitbricks/util/Preconditions.java
deleted file mode 100644
index b15689d..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/util/Preconditions.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.util;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Strings.isNullOrEmpty;
-import static com.google.common.net.InetAddresses.isInetAddress;
-import static org.jclouds.profitbricks.util.MacAddresses.isMacAddress;
-import static org.jclouds.profitbricks.util.Passwords.isValidPassword;
-
-import java.util.List;
-import java.util.regex.Pattern;
-
-import org.jclouds.profitbricks.domain.Firewall;
-import org.jclouds.profitbricks.domain.Firewall.Protocol;
-
-/**
- * Static convenience methods for validating various ProfitBricks domain preconditions
- */
-public final class Preconditions {
-
- private static final Pattern INVALID_CHARS = Pattern.compile("^.*[@/\\|'`’^].*$");
-
- public static void checkInvalidChars(String name) {
- checkArgument(!isNullOrEmpty(name), "Name is required.");
- checkArgument(!INVALID_CHARS.matcher(name).matches(), "Name must not contain any of: @ / \\ | ' ` ’ ^");
- }
-
- public static void checkIp(String ip) {
- checkArgument(isInetAddress(ip), "IP '%s' is invalid", ip);
- }
-
- public static void checkIps(List<String> ips) {
- checkNotNull(ips, "Null ip list");
- for (String ip : ips)
- checkIp(ip);
- }
-
- public static void checkPortRange(Integer portRangeStart, Integer portRangeEnd, Firewall.Protocol protocol) {
- checkArgument(!(portRangeEnd == null ^ portRangeStart == null), "Port range must be both present or null");
- if (portRangeEnd != null) {
- checkArgument(protocol == Firewall.Protocol.TCP || protocol == Firewall.Protocol.UDP, "Port range can only be set for TCP or UDP");
- checkArgument(portRangeEnd > portRangeStart, "portRangeEnd must be greater than portRangeStart");
- checkArgument(portRangeEnd >= 1 && portRangeEnd <= 65534, "Port range end must be 1 to 65534");
- checkArgument(portRangeStart >= 1 && portRangeStart <= 65534, "Port range start must be 1 to 65534");
- }
- }
-
- public static void checkMacAddress(String macAddress) {
- checkArgument(isMacAddress(macAddress), "MAC must match pattern 'aa:bb:cc:dd:ee:ff'");
- }
-
- public static void checkIcmp(Integer icmpType, Integer icmpCode, Protocol protocol) {
- checkNotNull(protocol, "Protocol can't be null");
- if (protocol == Protocol.ICMP) {
- if (icmpType != null)
- checkArgument(icmpType >= 1 && icmpType <= 254, "ICMP type must be 1 to 254");
- if (icmpCode != null)
- checkArgument(icmpCode >= 1 && icmpCode <= 254, "ICMP code must be 1 to 254");
- }
- }
-
- public static void checkLanId(Integer id) {
- checkArgument(id >= 0, "LAN ID must be non-negative");
- }
-
- public static void checkCores(Integer cores) {
- checkArgument(cores > 0, "Number of cores must be atleast 1.");
- }
-
- public static void checkRam(Integer ram, Boolean isRamHotPlug) {
- int minRam = (isRamHotPlug == null || !isRamHotPlug) ? 256 : 1024;
- checkArgument(ram >= minRam && ram % 256 == 0, "RAM must be multiples of 256 with minimum of 256 MB "
- + "(1024 MB if ramHotPlug is enabled)");
- }
-
- public static void checkSize(Float size) {
- checkArgument(size > 1, "Storage size must be > 1GB");
- }
-
- public static void checkPassword(String password) {
- checkArgument(isValidPassword(password), "Password must be between 8 and 50 characters, "
- + "only a-z, A-Z, 0-9 without characters i, I, l, o, O, w, W, y, Y, z, Z and 1, 0");
- }
-}
[02/11] jclouds-labs git commit: Remove ProfitBricks
Posted by de...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/nic/NicResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/nic/NicResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/nic/NicResponseHandlerTest.java
deleted file mode 100644
index 3797ca0..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/nic/NicResponseHandlerTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.nic;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import com.google.common.collect.ImmutableList;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.Firewall;
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "NicResponseHandlerTest")
-public class NicResponseHandlerTest extends BaseResponseHandlerTest<Nic> {
-
- @Override
- protected ParseSax<Nic> createParser() {
- return factory.create(injector.getInstance(NicResponseHandler.class));
- }
-
- @Test
- public void testParseResponseFromGetNic() {
- ParseSax<Nic> parser = createParser();
- Nic actual = parser.parse(payloadFromResource("/nic/nic.xml"));
- assertNotNull(actual, "Parsed content returned null");
-
- Nic expected = Nic.builder()
- .id("12345678-abcd-efgh-ijkl-987654321000")
- .dataCenterId("0")
- .name("name")
- .lanId(1)
- .internetAccess(true)
- .serverId("server-id")
- .ips(ImmutableList.of("192.168.0.1"))
- .macAddress("aa:bb:cc:dd:ee:ff")
- .dhcpActive(true)
- .gatewayIp("10.0.0.1")
- .state(ProvisioningState.AVAILABLE)
- .firewall(
- Firewall.builder()
- .active(true)
- .id("firewall-id")
- .nicId("nic-id")
- .state(ProvisioningState.AVAILABLE)
- .build())
- .build();
-
- assertEquals(actual, expected);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerIdOnlyResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerIdOnlyResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerIdOnlyResponseHandlerTest.java
deleted file mode 100644
index 19bc29d..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerIdOnlyResponseHandlerTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.server;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ServerIdOnlyResponseHandlerTest")
-public class ServerIdOnlyResponseHandlerTest extends BaseResponseHandlerTest<String> {
-
- @Override
- protected ParseSax<String> createParser() {
- return factory.create(injector.getInstance(ServerIdOnlyResponseHandler.class));
- }
-
- @Test
- public void testParseResponseFromCreateServer() {
- ParseSax<String> parser = createParser();
-
- String serverId = parser.parse(payloadFromResource("/server/server-create.xml"));
-
- assertEquals("qwertyui-qwer-qwer-qwer-qwertyyuiiop", serverId);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 03fb3da..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerInfoResponseHandlerTest.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.server;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.date.DateService;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.AvailabilityZone;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Firewall;
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.domain.OsType;
-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 org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit", testName = "ServerInfoResponseHandlerTest")
-public class ServerInfoResponseHandlerTest extends BaseResponseHandlerTest<Server> {
-
- @Override
- protected ParseSax<Server> createParser() {
- return factory.create(injector.getInstance(ServerInfoResponseHandler.class));
- }
-
- protected DateService createDateParser() {
- return injector.getInstance(DateService.class);
- }
-
- @Test
- public void testParseResponseFromGetServer() {
- ParseSax<Server> parser = createParser();
-
- Server actual = parser.parse(payloadFromResource("/server/server.xml"));
- assertNotNull(actual, "Parsed content returned null");
-
- DateService dateParser = createDateParser();
-
- Server expected = Server.builder()
- .id("qwertyui-qwer-qwer-qwer-qwertyyuiiop")
- .dataCenter(DataCenter.builder()
- .id("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
- .version(10)
- .build())
- .name("facebook-node")
- .cores(4)
- .ram(4096)
- .hasInternetAccess(true)
- .state(ProvisioningState.AVAILABLE)
- .status(Server.Status.RUNNING)
- .creationTime(dateParser.iso8601DateOrSecondsDateParse("2014-12-04T07:09:23.138Z"))
- .lastModificationTime(dateParser.iso8601DateOrSecondsDateParse("2014-12-12T03:08:35.629Z"))
- .osType(OsType.LINUX)
- .availabilityZone(AvailabilityZone.AUTO)
- .isCpuHotPlug(true)
- .isRamHotPlug(true)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .loadBalanced(true)
- .balancedNicId("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
- .storages(ImmutableList.<Storage>of(
- Storage.builder()
- .bootDevice(Boolean.TRUE)
- .busType(Storage.BusType.VIRTIO)
- .deviceNumber(1)
- .size(40f)
- .id("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
- .name("facebook-storage")
- .build()
- )
- )
- .nics(ImmutableList.<Nic>of(
- Nic.builder()
- .dataCenterId("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
- .id("qwqwqwqw-wewe-erer-rtrt-tytytytytyty")
- .lanId(1)
- .internetAccess(true)
- .serverId("qwertyui-qwer-qwer-qwer-qwertyyuiiop")
- .ips(ImmutableList.of("173.252.120.6"))
- .macAddress("02:01:09:cd:f0:b0")
- .firewall(Firewall.builder()
- .active(false)
- .id("wqwqwqwq-ewew-rere-trtr-ytytytytytyt")
- .nicId("qwqwqwqw-wewe-erer-rtrt-tytytytytyty")
- .state(ProvisioningState.AVAILABLE)
- .build())
- .dhcpActive(true)
- .gatewayIp("173.252.120.1")
- .state(ProvisioningState.AVAILABLE)
- .build()
- ))
- .build();
-
- assertEquals(actual, expected);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 95c7923..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerListResponseHandlerTest.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * 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.server;
-
-import com.google.common.collect.ImmutableList;
-
-import java.util.List;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.AvailabilityZone;
-import org.jclouds.profitbricks.domain.OsType;
-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.jclouds.date.DateService;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Firewall;
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.domain.Storage;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ServerListResponseHandlerTest")
-public class ServerListResponseHandlerTest extends BaseResponseHandlerTest<List<Server>> {
-
- @Override
- protected ParseSax<List<Server>> createParser() {
- return factory.create(injector.getInstance(ServerListResponseHandler.class));
- }
-
- protected DateService createDateParser() {
- return injector.getInstance(DateService.class);
- }
-
- @Test
- public void testParseResponseFromGetAllServers() {
- ParseSax<List<Server>> parser = createParser();
-
- List<Server> actual = parser.parse(payloadFromResource("/server/servers.xml"));
- assertNotNull(actual, "Parsed content returned null");
-
- DateService dateParser = createDateParser();
-
- List<Server> expected = ImmutableList.<Server>of(
- Server.builder()
- .dataCenter(DataCenter.builder()
- .id("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
- .version(10)
- .build()
- )
- .id("qwertyui-qwer-qwer-qwer-qwertyyuiiop")
- .name("facebook-node")
- .cores(4)
- .ram(4096)
- .hasInternetAccess(true)
- .state(ProvisioningState.AVAILABLE)
- .status(Server.Status.RUNNING)
- .creationTime(dateParser.iso8601DateOrSecondsDateParse("2014-12-04T07:09:23.138Z"))
- .lastModificationTime(dateParser.iso8601DateOrSecondsDateParse("2014-12-12T03:08:35.629Z"))
- .osType(OsType.LINUX)
- .availabilityZone(AvailabilityZone.AUTO)
- .isCpuHotPlug(true)
- .isRamHotPlug(true)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .loadBalanced(true)
- .balancedNicId("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
- .storages(ImmutableList.<Storage>of(
- Storage.builder()
- .bootDevice(Boolean.TRUE)
- .busType(Storage.BusType.VIRTIO)
- .deviceNumber(1)
- .size(40f)
- .id("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
- .name("facebook-storage")
- .build()
- )
- )
- .nics(ImmutableList.<Nic>of(
- Nic.builder()
- .dataCenterId("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
- .id("qwqwqwqw-wewe-erer-rtrt-tytytytytyty")
- .lanId(1)
- .internetAccess(true)
- .serverId("qwertyui-qwer-qwer-qwer-qwertyyuiiop")
- .ips(ImmutableList.of("173.252.120.6"))
- .macAddress("02:01:09:cd:f0:b0")
- .firewall(Firewall.builder()
- .active(false)
- .id("wqwqwqwq-ewew-rere-trtr-ytytytytytyt")
- .nicId("qwqwqwqw-wewe-erer-rtrt-tytytytytyty")
- .state(ProvisioningState.AVAILABLE)
- .build())
- .dhcpActive(true)
- .gatewayIp("173.252.120.1")
- .state(ProvisioningState.AVAILABLE)
- .build()
- )
- )
- .build(),
- Server.builder()
- .dataCenter(DataCenter.builder()
- .id("qqqqqqqq-wwww-rrrr-tttt-yyyyyyyyyyyy")
- .version(238)
- .build()
- )
- .id("asdfghjk-asdf-asdf-asdf-asdfghjklkjl")
- .name("google-node")
- .cores(1)
- .ram(1024)
- .hasInternetAccess(false)
- .state(ProvisioningState.AVAILABLE)
- .status(Server.Status.RUNNING)
- .creationTime(dateParser.iso8601DateOrSecondsDateParse("2014-11-12T07:01:00.441Z"))
- .lastModificationTime(dateParser.iso8601DateOrSecondsDateParse("2014-11-12T07:01:00.441Z"))
- .osType(OsType.LINUX)
- .availabilityZone(AvailabilityZone.AUTO)
- .isCpuHotPlug(true)
- .isRamHotPlug(true)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .loadBalanced(true)
- .balancedNicId("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
- .storages(ImmutableList.<Storage>of(
- Storage.builder()
- .bootDevice(Boolean.TRUE)
- .busType(Storage.BusType.VIRTIO)
- .deviceNumber(1)
- .size(5f)
- .id("asfasfle-f23n-cu89-klfr-njkdsvwllkfa")
- .name("google-disk")
- .build()
- )
- )
- .nics(ImmutableList.<Nic>of(
- Nic.builder()
- .dataCenterId("qqqqqqqq-wwww-rrrr-tttt-yyyyyyyyyyyy")
- .id("mkl45h5e-sdgb-h6rh-235r-rfweshdfhreh")
- .lanId(3)
- .internetAccess(false)
- .serverId("asdfghjk-asdf-asdf-asdf-asdfghjklkjl")
- .ips(ImmutableList.of("202.69.181.241"))
- .macAddress("02:01:9e:5e:35:1e")
- .firewall(Firewall.builder()
- .active(false)
- .id("cvvdsgbd-sdgj-eger-h56j-wet43gvsgeg4")
- .nicId("mkl45h5e-sdgb-h6rh-235r-rfweshdfhreh")
- .state(ProvisioningState.INPROCESS)
- .build())
- .dhcpActive(false)
- .gatewayIp("202.69.181.1")
- .state(ProvisioningState.AVAILABLE)
- .build()
- )
- )
- .build()
- );
-
- assertEquals(actual, expected);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotListResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotListResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotListResponseHandlerTest.java
deleted file mode 100644
index 37cdb96..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotListResponseHandlerTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.snapshot;
-
-import com.google.common.collect.Lists;
-
-import java.util.List;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.date.DateService;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "SnapshotListResponseHandlerTest")
-public class SnapshotListResponseHandlerTest extends BaseResponseHandlerTest<List<Snapshot>> {
-
- @Override
- protected ParseSax<List<Snapshot>> createParser() {
- return factory.create(injector.getInstance(SnapshotListResponseHandler.class));
- }
-
- protected DateService createDateParser() {
- return injector.getInstance(DateService.class);
- }
-
- @Test
- public void testParseResponseFromGetSnapshot() {
- ParseSax<List<Snapshot>> parser = createParser();
-
- List<Snapshot> actual = parser.parse(payloadFromResource("/snapshot/snapshots.xml"));
- assertNotNull(actual);
-
- DateService dateParser = createDateParser();
-
- List<Snapshot> expected = Lists.newArrayList();
-
- expected.add(Snapshot.builder()
- .id("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
- .description("description")
- .size(1024f)
- .name("snapshot01")
- .state(ProvisioningState.AVAILABLE)
- .isBootable(true)
- .osType(OsType.LINUX)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(true)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .isRamHotPlug(true)
- .isRamHotUnPlug(true)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .location(Location.US_LAS)
- .creationTime(dateParser.iso8601DateOrSecondsDateParse("2015-01-26T07:09:23.138Z"))
- .lastModificationTime(dateParser.iso8601DateOrSecondsDateParse("2015-01-26T07:09:23.138Z"))
- .build());
-
- expected.add(Snapshot.builder()
- .id("qqqqqqqq-wwww-rrrr-tttt-yyyyyyyyyyyy")
- .description("description")
- .size(1024f)
- .name("snapshot02")
- .state(ProvisioningState.AVAILABLE)
- .isBootable(true)
- .osType(OsType.LINUX)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(true)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .isRamHotPlug(true)
- .isRamHotUnPlug(true)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .location(Location.US_LAS)
- .creationTime(dateParser.iso8601DateOrSecondsDateParse("2015-01-26T07:09:23.138Z"))
- .lastModificationTime(dateParser.iso8601DateOrSecondsDateParse("2015-01-26T07:09:23.138Z"))
- .build());
-
- assertEquals(actual, expected);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotResponseHandlerTest.java
deleted file mode 100644
index 1a73c9f..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/snapshot/SnapshotResponseHandlerTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.snapshot;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.date.DateService;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ServerResponseHandlerTest")
-public class SnapshotResponseHandlerTest extends BaseResponseHandlerTest<Snapshot> {
-
- @Override
- protected ParseSax<Snapshot> createParser() {
- return factory.create(injector.getInstance(SnapshotResponseHandler.class));
- }
-
- protected DateService createDateParser() {
- return injector.getInstance(DateService.class);
- }
-
- @Test
- public void testParseResponseFromGetSnapshot() {
- ParseSax<Snapshot> parser = createParser();
-
- Snapshot actual = parser.parse(payloadFromResource("/snapshot/snapshot.xml"));
- assertNotNull(actual, "Parsed content returned null");
-
- DateService dateParser = createDateParser();
-
- Snapshot expected = Snapshot.builder()
- .id("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
- .description("description")
- .size(1024f)
- .name("snapshot01")
- .state(ProvisioningState.AVAILABLE)
- .isBootable(true)
- .osType(OsType.LINUX)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(true)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .isRamHotPlug(true)
- .isRamHotUnPlug(true)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .location(Location.US_LAS)
- .creationTime(dateParser.iso8601DateOrSecondsDateParse("2015-01-26T07:09:23.138Z"))
- .lastModificationTime(dateParser.iso8601DateOrSecondsDateParse("2015-01-26T07:09:23.138Z"))
- .build();
-
- assertEquals(actual, expected);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/state/GetProvisioningStateResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/state/GetProvisioningStateResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/state/GetProvisioningStateResponseHandlerTest.java
deleted file mode 100644
index 3bd2755..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/state/GetProvisioningStateResponseHandlerTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.state;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "GetProvisioningStateResponseHandlerTest")
-public class GetProvisioningStateResponseHandlerTest extends BaseResponseHandlerTest<ProvisioningState> {
-
- @Override
- protected ParseSax<ProvisioningState> createParser() {
- return factory.create(injector.getInstance(GetProvisioningStateResponseHandler.class));
- }
-
- @Test
- public void testParseResponseFromGetProvisioningState() {
- ParseSax<ProvisioningState> parser = createParser();
-
- for (Map.Entry<ProvisioningState, String> pair : sampleResponses.entrySet()) {
- ProvisioningState actual = parser.parse(pair.getValue());
- assertNotNull(actual, "Parsed content returned null");
-
- assertEquals(pair.getKey(), actual);
- }
-
- }
-
- private final Map<ProvisioningState, String> sampleResponses = new LinkedHashMap<ProvisioningState, String>() {
- {
- put(ProvisioningState.INACTIVE,
- "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
- + " <soapenv:Header/>\n"
- + " <soapenv:Body>\n"
- + " <ws:getDataCenterStateResponse>\n"
- + " <return>INACTIVE</return>\n"
- + " </ws:getDataCenterStateResponse>\n"
- + " </soapenv:Body>\n"
- + "</soapenv:Envelope>");
- put(ProvisioningState.INPROCESS,
- "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
- + " <soapenv:Header/>\n"
- + " <soapenv:Body>\n"
- + " <ws:getDataCenterStateResponse>\n"
- + " <return>INPROCESS</return>\n"
- + " </ws:getDataCenterStateResponse>\n"
- + " </soapenv:Body>\n"
- + "</soapenv:Envelope>");
- put(ProvisioningState.AVAILABLE,
- "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
- + " <soapenv:Header/>\n"
- + " <soapenv:Body>\n"
- + " <ws:getDataCenterStateResponse>\n"
- + " <return>AVAILABLE</return>\n"
- + " </ws:getDataCenterStateResponse>\n"
- + " </soapenv:Body>\n"
- + "</soapenv:Envelope>");
- put(ProvisioningState.DELETED,
- "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
- + " <soapenv:Header/>\n"
- + " <soapenv:Body>\n"
- + " <ws:getDataCenterStateResponse>\n"
- + " <return>DELETED</return>\n"
- + " </ws:getDataCenterStateResponse>\n"
- + " </soapenv:Body>\n"
- + "</soapenv:Envelope>");
- put(ProvisioningState.ERROR,
- "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
- + " <soapenv:Header/>\n"
- + " <soapenv:Body>\n"
- + " <ws:getDataCenterStateResponse>\n"
- + " <return>ERROR</return>\n"
- + " </ws:getDataCenterStateResponse>\n"
- + " </soapenv:Body>\n"
- + "</soapenv:Envelope>");
- put(ProvisioningState.UNRECOGNIZED,
- "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
- + " <soapenv:Header/>\n"
- + " <soapenv:Body>\n"
- + " <ws:getDataCenterStateResponse>\n"
- + " <return>MEH</return>\n"
- + " </ws:getDataCenterStateResponse>\n"
- + " </soapenv:Body>\n"
- + "</soapenv:Envelope>");
- }
- };
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/storage/StorageIdOnlyResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/storage/StorageIdOnlyResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/storage/StorageIdOnlyResponseHandlerTest.java
deleted file mode 100644
index def23b6..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/storage/StorageIdOnlyResponseHandlerTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.storage;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "StorageIdOnlyResponseHandlerTest")
-public class StorageIdOnlyResponseHandlerTest extends BaseResponseHandlerTest<String> {
-
- @Override
- protected ParseSax<String> createParser() {
- return factory.create(injector.getInstance(StorageIdOnlyResponseHandler.class));
- }
-
- @Test
- public void testParseResponseFromCreateStorage() {
- ParseSax<String> parser = createParser();
-
- String storageId = parser.parse(payloadFromResource("/storage/storage-create.xml"));
-
- assertEquals("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh", storageId);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/storage/StorageInfoResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/storage/StorageInfoResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/storage/StorageInfoResponseHandlerTest.java
deleted file mode 100644
index 411865f..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/storage/StorageInfoResponseHandlerTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.storage;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.date.DateService;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.domain.Storage;
-import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit", testName = "StorageInfoResponseHandlerTest")
-public class StorageInfoResponseHandlerTest extends BaseResponseHandlerTest<Storage> {
-
- @Override
- protected ParseSax<Storage> createParser() {
- return factory.create(injector.getInstance(StorageInfoResponseHandler.class));
- }
-
- protected DateService createDateParser() {
- return injector.getInstance(DateService.class);
- }
-
- @Test
- public void testParseResponseFromGetStorage() {
- ParseSax<Storage> parser = createParser();
-
- Storage actual = parser.parse(payloadFromResource("/storage/storage.xml"));
- assertNotNull(actual, "Parsed content returned null");
-
- DateService dateParser = createDateParser();
-
- Storage expected = Storage.builder()
- .id("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
- .size(40)
- .name("hdd-1")
- .state(ProvisioningState.AVAILABLE)
- .serverIds(ImmutableList.<String>of("qwertyui-qwer-qwer-qwer-qwertyyuiiop"))
- .creationTime(dateParser.iso8601DateOrSecondsDateParse("2014-12-04T07:09:23.138Z"))
- .lastModificationTime(dateParser.iso8601DateOrSecondsDateParse("2014-12-12T03:14:48.316Z"))
- .build();
-
- assertEquals(actual, expected);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/storage/StorageListResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/storage/StorageListResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/storage/StorageListResponseHandlerTest.java
deleted file mode 100644
index 9ac696d..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/storage/StorageListResponseHandlerTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.storage;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import com.google.common.collect.ImmutableList;
-
-import java.util.List;
-
-import org.jclouds.date.DateService;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.domain.Storage;
-import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
-
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "StorageListResponseHandlerTest")
-public class StorageListResponseHandlerTest extends BaseResponseHandlerTest<List<Storage>> {
-
- @Override
- protected ParseSax<List<Storage>> createParser() {
- return factory.create(injector.getInstance(StorageListResponseHandler.class));
- }
-
- protected DateService createDateParser() {
- return injector.getInstance(DateService.class);
- }
-
- @Test
- public void testParseResponseFromGetAllStorages() {
- ParseSax<List<Storage>> parser = createParser();
-
- List<Storage> actual = parser.parse(payloadFromResource("/storage/storages.xml"));
- assertNotNull(actual, "Parsed content returned null");
-
- DateService dateParser = createDateParser();
-
- List<Storage> expected = ImmutableList.<Storage>of(
- Storage.builder()
- .id("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
- .size(40f)
- .name("hdd-1")
- .state(ProvisioningState.AVAILABLE)
- .serverIds(ImmutableList.<String>of("qwertyui-qwer-qwer-qwer-qwertyyuiiop"))
- .creationTime(dateParser.iso8601DateOrSecondsDateParse("2014-12-04T07:09:23.138Z"))
- .lastModificationTime(dateParser.iso8601DateOrSecondsDateParse("2014-12-12T03:14:48.316Z"))
- .build(),
- Storage.builder()
- .id("asfasfle-f23n-cu89-klfr-njkdsvwllkfa")
- .size(100f)
- .name("hdd-2")
- .state(ProvisioningState.INPROCESS)
- .serverIds(ImmutableList.<String>of("asdfghjk-asdf-asdf-asdf-asdfghjklkjl"))
- .creationTime(dateParser.iso8601DateOrSecondsDateParse("2014-11-04T07:09:23.138Z"))
- .lastModificationTime(dateParser.iso8601DateOrSecondsDateParse("2014-11-12T03:14:48.316Z"))
- .build()
- );
-
- assertEquals(actual, expected);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/internal/BaseProfitBricksMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/internal/BaseProfitBricksMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/internal/BaseProfitBricksMockTest.java
deleted file mode 100644
index d5883a6..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/internal/BaseProfitBricksMockTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.internal;
-
-import static org.jclouds.util.Strings2.toStringAndClose;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Properties;
-import java.util.Set;
-
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.ContextBuilder;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.profitbricks.ProfitBricksApi;
-
-import com.google.common.base.Charsets;
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-import com.squareup.okhttp.mockwebserver.RecordedRequest;
-
-/**
- * Base class for all ProfitBricks mock test
- */
-public class BaseProfitBricksMockTest {
-
- protected static final String authHeader = BasicAuthentication.basic("username", "password");
- protected static final String provider = "profitbricks";
- protected static final String rootUrl = "/1.3";
-
- private static final String SOAP_PREFIX
- = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">"
- + "<soapenv:Header/>"
- + "<soapenv:Body>";
-
- private static final String SOAP_SUFFIX = "</soapenv:Body></soapenv:Envelope>";
-
- private final Set<Module> modules = ImmutableSet.<Module>of();
-
- public BaseProfitBricksMockTest() {
- }
-
- public ProfitBricksApi api(URL url) {
- return ContextBuilder.newBuilder(provider)
- .credentials("username", "password")
- .endpoint(url.toString())
- .modules(modules)
- .overrides(setupProperties())
- .buildApi(ProfitBricksApi.class);
- }
-
- protected Properties setupProperties() {
- return new Properties();
- }
-
- public static MockWebServer mockWebServer() throws IOException {
- MockWebServer server = new MockWebServer();
- server.play();
- return server;
- }
-
- public byte[] payloadFromResource(String resource) {
- try {
- return toStringAndClose(getClass().getResourceAsStream(resource)).getBytes(Charsets.UTF_8);
- } catch (IOException e) {
- throw Throwables.propagate(e);
- }
- }
-
- protected static String payloadSoapWithBody(String body) {
- return SOAP_PREFIX.concat(body).concat(SOAP_SUFFIX);
- }
-
- protected static void assertRequestHasCommonProperties(final RecordedRequest request) {
- assertEquals(request.getMethod(), "POST");
- assertEquals(request.getPath(), rootUrl);
- assertEquals(request.getHeader(HttpHeaders.AUTHORIZATION), authHeader);
- assertEquals(request.getHeader(HttpHeaders.ACCEPT), MediaType.TEXT_XML);
- }
-
- protected static void assertRequestHasCommonProperties(final RecordedRequest request, String content) {
- assertEquals(new String(request.getBody()), payloadSoapWithBody(content));
- assertRequestHasCommonProperties(request);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/util/MacAddressesTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/util/MacAddressesTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/util/MacAddressesTest.java
deleted file mode 100644
index 1f0ae7a..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/util/MacAddressesTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.util;
-
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-import static org.jclouds.profitbricks.util.MacAddresses.isMacAddress;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "MacAddressesTest")
-public class MacAddressesTest {
-
- private final List<String> expectedValidAddresses = ImmutableList.of(
- "aa:bb:cc:dd:ee:ff", "11:22:33:44:55:66"
- );
- private final List<String> expectedInvalidAddresses = ImmutableList.of(
- "AA:BB:CC:DD:EE:FF", "aa-bb-cc-dd-ee-ff", "", "aabbccddeeff",
- "aa:bb:cc:dd:ff", "gg:aa:bb:cc:dd:ee"
- );
-
- @Test
- public void testIsMacAddress() {
- for (String addr : expectedValidAddresses)
- assertTrue(isMacAddress(addr));
-
- for (String addr : expectedInvalidAddresses)
- assertFalse(isMacAddress(addr));
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/util/PasswordsTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/util/PasswordsTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/util/PasswordsTest.java
deleted file mode 100644
index fc7be1f..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/util/PasswordsTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.util;
-
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-import static org.jclouds.profitbricks.util.Passwords.isValidPassword;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "PasswordsTest")
-public class PasswordsTest {
-
- private final List<String> validPasswords = ImmutableList.of(
- "fKVasTnNm", "84625894", "QQQQQQQQ", "qqqqqqqq", "asdfghjk"
- );
- private final List<String> invalidPasswords = ImmutableList.of(
- "", "apachejclouds", "s0merand0mpassw0rd"
- );
-
- @Test
- public void testPasswordValidation() {
- for (String pwd : validPasswords)
- assertTrue(isValidPassword(pwd), "Should've been valid: " + pwd);
-
- for (String pwd : invalidPasswords)
- assertFalse(isValidPassword(pwd), "Should've been invalid: " + pwd);
- }
-
- @Test
- public void testGeneratorGeneratesValidPassword() {
- final int times = 50;
- for (int i = 0; i < times; i++) {
- String pwd = Passwords.generate();
- assertTrue(isValidPassword(pwd), "Failed with: " + pwd);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/datacenter/datacenter-cleared.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/datacenter/datacenter-cleared.xml b/profitbricks/src/test/resources/datacenter/datacenter-cleared.xml
deleted file mode 100644
index 5b85c96..0000000
--- a/profitbricks/src/test/resources/datacenter/datacenter-cleared.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:clearDataCenterResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>1143191</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>3</dataCenterVersion>
- </return>
- </ns2:clearDataCenterResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/datacenter/datacenter-created.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/datacenter/datacenter-created.xml b/profitbricks/src/test/resources/datacenter/datacenter-created.xml
deleted file mode 100644
index 92ef01d..0000000
--- a/profitbricks/src/test/resources/datacenter/datacenter-created.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.api.profitbricks.com/">
- <soapenv:Body>
- <ws:createDataCenterResponse>
- <return>
- <requestId>102456</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>1</dataCenterVersion>
- <location>de/fra</location>
- </return>
- </ws:createDataCenterResponse>
- </soapenv:Body>
-</soapenv:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/datacenter/datacenter-deleted.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/datacenter/datacenter-deleted.xml b/profitbricks/src/test/resources/datacenter/datacenter-deleted.xml
deleted file mode 100644
index 531ed53..0000000
--- a/profitbricks/src/test/resources/datacenter/datacenter-deleted.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:deleteDataCenterResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>11411363</requestId>
- </return>
- </ns2:deleteDataCenterResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/datacenter/datacenter-not-found.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/datacenter/datacenter-not-found.xml b/profitbricks/src/test/resources/datacenter/datacenter-not-found.xml
deleted file mode 100644
index e4a9701..0000000
--- a/profitbricks/src/test/resources/datacenter/datacenter-not-found.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
- <faultcode>S:Server</faultcode>
- <faultstring>The requested resource could not be found. Please refer to Request Id : 11122416. [VDC-6-404] The requested data center does not exist or already deleted by the users. ResourceId random-non-existing-id</faultstring>
- <detail>
- <ns2:ProfitbricksServiceFault xmlns:ns2="http://ws.api.profitbricks.com/">
- <faultCode>RESOURCE_NOT_FOUND</faultCode>
- <httpCode>404</httpCode>
- <message>The requested resource could not be found. Please refer to Request Id : 11122416. [VDC-6-404] The requested data center does not exist or already deleted by the users. ResourceId random-non-existing-id</message>
- <requestId>11122416</requestId>
- </ns2:ProfitbricksServiceFault>
- </detail>
- </S:Fault>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/datacenter/datacenter-state-inprocess.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/datacenter/datacenter-state-inprocess.xml b/profitbricks/src/test/resources/datacenter/datacenter-state-inprocess.xml
deleted file mode 100644
index 722c653..0000000
--- a/profitbricks/src/test/resources/datacenter/datacenter-state-inprocess.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getDataCenterStateResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>INPROCESS</return>
- </ns2:getDataCenterStateResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/datacenter/datacenter-state.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/datacenter/datacenter-state.xml b/profitbricks/src/test/resources/datacenter/datacenter-state.xml
deleted file mode 100644
index 3327c82..0000000
--- a/profitbricks/src/test/resources/datacenter/datacenter-state.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getDataCenterStateResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>AVAILABLE</return>
- </ns2:getDataCenterStateResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/datacenter/datacenter-updated.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/datacenter/datacenter-updated.xml b/profitbricks/src/test/resources/datacenter/datacenter-updated.xml
deleted file mode 100644
index f0c84d4..0000000
--- a/profitbricks/src/test/resources/datacenter/datacenter-updated.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:updateDataCenterResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>1143190</requestId>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterVersion>2</dataCenterVersion>
- </return>
- </ns2:updateDataCenterResponse>
- </S:Body>
-</S:Envelope>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/datacenter/datacenter.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/datacenter/datacenter.xml b/profitbricks/src/test/resources/datacenter/datacenter.xml
deleted file mode 100644
index 3df1f8b..0000000
--- a/profitbricks/src/test/resources/datacenter/datacenter.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getDataCenterResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>10933055</requestId>
- <dataCenterId>12345678-abcd-efgh-ijkl-987654321000</dataCenterId>
- <dataCenterVersion>10</dataCenterVersion>
- <dataCenterName>JClouds-DC</dataCenterName>
- <servers>
- <dataCenterId>12345678-abcd-efgh-ijkl-987654321000</dataCenterId>
- <dataCenterVersion>10</dataCenterVersion>
- <serverId>qqqqqqqq-wwww-eeee-rrrr-tttttttttttt</serverId>
- <serverName>jnode1</serverName>
- <cores>4</cores>
- <ram>4096</ram>
- <internetAccess>true</internetAccess>
- <ips>202.94.38.12</ips>
- <connectedStorages>
- <bootDevice>true</bootDevice>
- <busType>VIRTIO</busType>
- <deviceNumber>1</deviceNumber>
- <size>40</size>
- <storageId>ssssssss-aaaa-ffff-gggg-hhhhhhhhhhhh</storageId>
- <storageName>jnode1-disk1</storageName>
- </connectedStorages>
- <nics>
- <dataCenterId>12345678-abcd-efgh-ijkl-987654321000</dataCenterId>
- <dataCenterVersion>10</dataCenterVersion>
- <nicId>zzzzzzzz-xxxx-cccc-vvvv-bbbbbbbbbbbb</nicId>
- <lanId>1</lanId>
- <internetAccess>true</internetAccess>
- <serverId>qqqqqqqq-wwww-eeee-rrrr-tttttttttttt</serverId>
- <ips>202.94.38.12</ips>
- <macAddress>02:01:09:cd:f0:b0</macAddress>
- <firewall>
- <active>false</active>
- <firewallId>llllllll-kkkk-jjjj-hhhh-gggggggggggg</firewallId>
- <nicId>zzzzzzzz-xxxx-cccc-vvvv-bbbbbbbbbbbb</nicId>
- <provisioningState>AVAILABLE</provisioningState>
- </firewall>
- <dhcpActive>true</dhcpActive>
- <gatewayIp>202.94.38.1</gatewayIp>
- <provisioningState>AVAILABLE</provisioningState>
- </nics>
- <provisioningState>AVAILABLE</provisioningState>
- <virtualMachineState>RUNNING</virtualMachineState>
- <creationTime>2014-12-04T07:09:23.138Z</creationTime>
- <lastModificationTime>2014-12-12T03:08:35.629Z</lastModificationTime>
- <osType>LINUX</osType>
- <availabilityZone>AUTO</availabilityZone>
- <cpuHotPlug>true</cpuHotPlug>
- <ramHotPlug>true</ramHotPlug>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- </servers>
- <storages>
- <dataCenterId>12345678-abcd-efgh-ijkl-987654321000</dataCenterId>
- <dataCenterVersion>10</dataCenterVersion>
- <storageId>ssssssss-aaaa-ffff-gggg-hhhhhhhhhhhh</storageId>
- <size>40</size>
- <storageName>jnode1-disk1</storageName>
- <mountImage>
- <imageId>f0a59a5c-7940-11e4-8053-52540066fee9</imageId>
- <imageName>Ubuntu-14.04-LTS-server-2014-12-01</imageName>
- </mountImage>
- <serverIds>qqqqqqqq-wwww-eeee-rrrr-tttttttttttt</serverIds>
- <provisioningState>AVAILABLE</provisioningState>
- <creationTime>2014-12-04T07:09:23.138Z</creationTime>
- <lastModificationTime>2014-12-12T03:14:48.316Z</lastModificationTime>
- </storages>
- <provisioningState>AVAILABLE</provisioningState>
- <location>us/las</location>
- </return>
- </ns2:getDataCenterResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/datacenter/datacenters.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/datacenter/datacenters.xml b/profitbricks/src/test/resources/datacenter/datacenters.xml
deleted file mode 100644
index b3b7bc3..0000000
--- a/profitbricks/src/test/resources/datacenter/datacenters.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getAllDataCentersResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
- <dataCenterName>JClouds-DC</dataCenterName>
- <dataCenterVersion>10</dataCenterVersion>
- <provisioningState>AVAILABLE</provisioningState>
- </return>
- <return>
- <dataCenterId>qqqqqqqq-wwww-rrrr-tttt-yyyyyyyyyyyy</dataCenterId>
- <dataCenterName>Random DC</dataCenterName>
- <dataCenterVersion>238</dataCenterVersion>
- <provisioningState>INPROCESS</provisioningState>
- </return>
- </ns2:getAllDataCentersResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/drives/drives-add.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/drives/drives-add.xml b/profitbricks/src/test/resources/drives/drives-add.xml
deleted file mode 100644
index 52a04f5..0000000
--- a/profitbricks/src/test/resources/drives/drives-add.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:addRomDriveToServerResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>datacenter-version</dataCenterVersion>
- </return>
- </ns2:addRomDriveToServerResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/drives/drives-remove.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/drives/drives-remove.xml b/profitbricks/src/test/resources/drives/drives-remove.xml
deleted file mode 100644
index 699b359..0000000
--- a/profitbricks/src/test/resources/drives/drives-remove.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:removeRomDriveFromServerResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>datacenter-version</dataCenterVersion>
- </return>
- </ns2:removeRomDriveFromServerResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/fault-400.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/fault-400.xml b/profitbricks/src/test/resources/fault-400.xml
deleted file mode 100644
index 9648b2a..0000000
--- a/profitbricks/src/test/resources/fault-400.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
- <faultcode>S:Server</faultcode>
- <faultstring>RAM of requested server too small, 256 Mb is minimum</faultstring>
- <detail>
- <ns2:ProfitbricksServiceFault xmlns:ns2="http://ws.api.profitbricks.com/">
- <faultCode>BAD_REQUEST</faultCode>
- <httpCode>400</httpCode>
- <message>RAM of requested server too small, 256 Mb is minimum</message>
- <requestId>1045</requestId>
- </ns2:ProfitbricksServiceFault>
- </detail>
- </S:Fault>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/fault-401.html
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/fault-401.html b/profitbricks/src/test/resources/fault-401.html
deleted file mode 100644
index ecadab1..0000000
--- a/profitbricks/src/test/resources/fault-401.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" lang="en"/>
- <title>Profitbricks | 401 Unauthorized</title>
- <base href="/"/>
- <link rel="stylesheet" type="text/css" href="css/style.css"/>
- <link rel="stylesheet" type="text/css" href="css/content.css"/>
- <link rel="stylesheet" type="text/css" href="css/recent_additions.css"/>
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
- </head>
- <body>
- <div class="head1 h_bg"/>
- <div class="head2 h_bg"/>
- <div class="head3 h_bg"/>
- <div id="wrapper">
- <div class="wrapper_inner">
- <div id="header">
- <a id="logo" href="#">
- <img alt="Profitbricks" src="img/logo.png"/>
- </a>
- </div>
- <div id="main">
- <div id="right" style="min-height: 550px;">
- <div class="article msg">
- <h1>Unauthorized</h1>
- <img title="" alt="message error" src="img/msg_error.png" class="msg_sign" style="margin: 10px;" height="49" width="49"/>
- <div class="container" style="margin:20px 80px !important;">
- <p class="bigmargin">This request requires authentication.</p>
- </div>
- </div>
- </div>
- <br class="clear"/>
- </div>
- </div>
- </div>
- <div id="footer">
- <div class="bottom">
- <div class="inner"></div>
- </div>
- </div>
- </body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/fault-404.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/fault-404.xml b/profitbricks/src/test/resources/fault-404.xml
deleted file mode 100644
index 1875102..0000000
--- a/profitbricks/src/test/resources/fault-404.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
- <faultcode>S:Server</faultcode>
- <faultstring>The requested resource could not be found. Please refer to Request Id : 16370720. [VDC-6-404] The requested resource does not exist or already deleted by the users. ResourceId random-non-existing-id</faultstring>
- <detail>
- <ns2:ProfitbricksServiceFault xmlns:ns2="http://ws.api.profitbricks.com/">
- <faultCode>RESOURCE_NOT_FOUND</faultCode>
- <httpCode>404</httpCode>
- <message>The requested resource could not be found. Please refer to Request Id : 16370720. [VDC-6-404] The requested resource does not exist or already deleted by the users. ResourceId random-non-existing-id</message>
- <requestId>16370720</requestId>
- </ns2:ProfitbricksServiceFault>
- </detail>
- </S:Fault>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/fault-413.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/fault-413.xml b/profitbricks/src/test/resources/fault-413.xml
deleted file mode 100644
index b4d5f79..0000000
--- a/profitbricks/src/test/resources/fault-413.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
- <faultcode>S:Server</faultcode>
- <faultstring>New request exceeds the current capacity settings of this user contract. Please refer to Request Id : 16503940. [VDC-5-1020] Server has 12,800 MiB configured RAM. Your personal limit is 10,240 MiB per server.</faultstring>
- <detail>
- <ns2:ProfitbricksServiceFault xmlns:ns2="http://ws.api.profitbricks.com/">
- <faultCode>OVER_LIMIT_SETTING</faultCode>
- <httpCode>413</httpCode>
- <message>New request exceeds the current capacity settings of this user contract. Please refer to Request Id : 16503940. [VDC-5-1020] Server has 12,800 MiB configured RAM. Your personal limit is 10,240 MiB per server.</message>
- <requestId>16503940</requestId>
- </ns2:ProfitbricksServiceFault>
- </detail>
- </S:Fault>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/firewall/firewall-activate.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/firewall/firewall-activate.xml b/profitbricks/src/test/resources/firewall/firewall-activate.xml
deleted file mode 100644
index 16e32b9..0000000
--- a/profitbricks/src/test/resources/firewall/firewall-activate.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:activateFirewallsResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>datacenter-version</dataCenterVersion>
- </return>
- </ns2:activateFirewallsResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/firewall/firewall-addtonic.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/firewall/firewall-addtonic.xml b/profitbricks/src/test/resources/firewall/firewall-addtonic.xml
deleted file mode 100644
index 740c042..0000000
--- a/profitbricks/src/test/resources/firewall/firewall-addtonic.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:addFirewallRulesToNicResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <active>active</active>
- <firewallId>firewall-id</firewallId>
- <firewallRules>
- <firewallRuleId>firewall-rule-id</firewallRuleId>
- <name>name</name>
- <portRangeEnd>45678</portRangeEnd>
- <portRangeStart>12345</portRangeStart>
- <protocol>TCP</protocol>
- <sourceIp>192.168.0.1</sourceIp>
- <sourceMac>aa:bb:cc:dd:ee:ff</sourceMac>
- <targetIp>192.168.0.2</targetIp>
- </firewallRules>
- <nicId>nic-id</nicId>
- <provisioningState>AVAILABLE</provisioningState>
- </return>
- </ns2:addFirewallRulesToNicResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/firewall/firewall-deactivate.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/firewall/firewall-deactivate.xml b/profitbricks/src/test/resources/firewall/firewall-deactivate.xml
deleted file mode 100644
index 0adaabd..0000000
--- a/profitbricks/src/test/resources/firewall/firewall-deactivate.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:deactivateFirewallsResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id1111</requestId>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>datacenter-version</dataCenterVersion>
- </return>
- </ns2:deactivateFirewallsResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/firewall/firewall-delete.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/firewall/firewall-delete.xml b/profitbricks/src/test/resources/firewall/firewall-delete.xml
deleted file mode 100644
index 26371a9..0000000
--- a/profitbricks/src/test/resources/firewall/firewall-delete.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:deleteFirewallsResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>datacenter-version</dataCenterVersion>
- </return>
- </ns2:deleteFirewallsResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/firewall/firewall-remove.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/firewall/firewall-remove.xml b/profitbricks/src/test/resources/firewall/firewall-remove.xml
deleted file mode 100644
index 6301e6a..0000000
--- a/profitbricks/src/test/resources/firewall/firewall-remove.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:removeFirewallRulesResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <requestId>request-id</requestId>
- <dataCenterId>datacenter-id</dataCenterId>
- <dataCenterVersion>datacenter-version</dataCenterVersion>
- </return>
- </ns2:removeFirewallRulesResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/firewall/firewall.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/firewall/firewall.xml b/profitbricks/src/test/resources/firewall/firewall.xml
deleted file mode 100644
index 839502c..0000000
--- a/profitbricks/src/test/resources/firewall/firewall.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getFirewallResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <active>true</active>
- <firewallId>firewall-id</firewallId>
- <firewallRules>
- <firewallRuleId>firewall-rule-id</firewallRuleId>
- <name>name</name>
- <portRangeEnd>45678</portRangeEnd>
- <portRangeStart>12345</portRangeStart>
- <protocol>TCP</protocol>
- <sourceIp>192.168.0.1</sourceIp>
- <sourceMac>aa:bb:cc:dd:ee:ff</sourceMac>
- <targetIp>192.168.0.2</targetIp>
- </firewallRules>
- <nicId>nic-id</nicId>
- <provisioningState>AVAILABLE</provisioningState>
- </return>
- </ns2:getFirewallResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/firewall/firewalls.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/firewall/firewalls.xml b/profitbricks/src/test/resources/firewall/firewalls.xml
deleted file mode 100644
index 5803fbf..0000000
--- a/profitbricks/src/test/resources/firewall/firewalls.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getFirewallResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <active>true</active>
- <firewallId>firewall-id</firewallId>
- <firewallRules>
- <firewallRuleId>firewall-rule-id</firewallRuleId>
- <name>name</name>
- <portRangeEnd>45678</portRangeEnd>
- <portRangeStart>12345</portRangeStart>
- <protocol>TCP</protocol>
- <sourceIp>192.168.0.1</sourceIp>
- <sourceMac>aa:bb:cc:dd:ee:ff</sourceMac>
- <targetIp>192.168.0.2</targetIp>
- </firewallRules>
- <nicId>nic-id</nicId>
- <provisioningState>AVAILABLE</provisioningState>
- </return>
- <return>
- <active>true</active>
- <firewallId>firewall-id2</firewallId>
- <firewallRules>
- <firewallRuleId>firewall-rule-id2</firewallRuleId>
- <name>name</name>
- <portRangeEnd>56789</portRangeEnd>
- <portRangeStart>23456</portRangeStart>
- <protocol>TCP</protocol>
- <sourceIp>192.168.0.2</sourceIp>
- <sourceMac>aa:bb:cc:dd:ee:ff</sourceMac>
- <targetIp>192.168.0.3</targetIp>
- </firewallRules>
- <nicId>nic-id</nicId>
- <provisioningState>AVAILABLE</provisioningState>
- </return>
- </ns2:getFirewallResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/image/image-not-found.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/image/image-not-found.xml b/profitbricks/src/test/resources/image/image-not-found.xml
deleted file mode 100644
index 98c9f3e..0000000
--- a/profitbricks/src/test/resources/image/image-not-found.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
- <faultcode>S:Server</faultcode>
- <faultstring>The requested resource could not be found. Please refer to Request Id : 16361390. [VDC-6-404] The requested image does not exist or already deleted by the users. ResourceId random-non-existing-id</faultstring>
- <detail>
- <ns2:ProfitbricksServiceFault xmlns:ns2="http://ws.api.profitbricks.com/">
- <faultCode>RESOURCE_NOT_FOUND</faultCode>
- <httpCode>404</httpCode>
- <message>The requested resource could not be found. Please refer to Request Id : 16361390. [VDC-6-404] The requested image does not exist or already deleted by the users. ResourceId random-non-existing-id</message>
- <requestId>16361390</requestId>
- </ns2:ProfitbricksServiceFault>
- </detail>
- </S:Fault>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/resources/image/image.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/image/image.xml b/profitbricks/src/test/resources/image/image.xml
deleted file mode 100644
index 0e56bad..0000000
--- a/profitbricks/src/test/resources/image/image.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:getImageResponse xmlns:ns2="http://ws.api.profitbricks.com/">
- <return>
- <bootable>true</bootable>
- <cpuHotPlug>true</cpuHotPlug>
- <cpuHotUnPlug>false</cpuHotUnPlug>
- <discVirtioHotPlug>true</discVirtioHotPlug>
- <discVirtioHotUnPlug>true</discVirtioHotUnPlug>
- <imageId>5ad99c9e-9166-11e4-9d74-52540066fee9</imageId>
- <imageName>Ubuntu-14.04-LTS-server-2015-01-01</imageName>
- <imageSize>2048</imageSize>
- <imageType>HDD</imageType>
- <location>us/las</location>
- <nicHotPlug>true</nicHotPlug>
- <nicHotUnPlug>true</nicHotUnPlug>
- <osType>LINUX</osType>
- <public>true</public>
- <ramHotPlug>true</ramHotPlug>
- <ramHotUnPlug>false</ramHotUnPlug>
- <writeable>true</writeable>
- </return>
- </ns2:getImageResponse>
- </S:Body>
-</S:Envelope>
\ No newline at end of file
[11/11] jclouds-labs git commit: Remove ProfitBricks
Posted by de...@apache.org.
Remove ProfitBricks
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/93aff921
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/93aff921
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/93aff921
Branch: refs/heads/master
Commit: 93aff9219883708a07ebebd303199c4426ba3ab1
Parents: 7b8adc6
Author: Reijhanniel Jearl Campos <de...@apache.org>
Authored: Sat Feb 20 00:43:56 2016 +0800
Committer: Reijhanniel Jearl Campos <de...@apache.org>
Committed: Sat Feb 20 00:43:56 2016 +0800
----------------------------------------------------------------------
pom.xml | 1 -
profitbricks/README.md | 61 ---
profitbricks/pom.xml | 151 ------
.../jclouds/profitbricks/ProfitBricksApi.java | 64 ---
.../profitbricks/ProfitBricksApiMetadata.java | 85 ----
.../ProfitBricksProviderMetadata.java | 114 -----
.../binder/BaseProfitBricksRequestBinder.java | 75 ---
.../CreateDataCenterRequestBinder.java | 44 --
.../UpdateDataCenterRequestBinder.java | 44 --
.../drive/AddRomDriveToServerRequestBinder.java | 45 --
.../AddFirewallRuleToNicRequestBinder.java | 53 --
.../binder/firewall/FirewallBinder.java | 95 ----
.../CreateLoadBalancerRequestBinder.java | 50 --
.../DeregisterLoadBalancerRequestBinder.java | 42 --
.../RegisterLoadBalancerRequestBinder.java | 44 --
.../UpdateLoadBalancerRequestBinder.java | 44 --
.../binder/nic/CreateNicRequestBinder.java | 46 --
.../binder/nic/SetInternetAccessBinder.java | 42 --
.../binder/nic/UpdateNicRequestBinder.java | 46 --
.../server/CreateServerRequestBinder.java | 57 ---
.../server/UpdateServerRequestBinder.java | 56 ---
.../snapshot/CreateSnapshotRequestBinder.java | 44 --
.../snapshot/RollbackSnapshotRequestBinder.java | 43 --
.../snapshot/UpdateSnapshotRequestBinder.java | 53 --
.../ConnectStorageToServerRequestBinder.java | 45 --
.../storage/CreateStorageRequestBinder.java | 46 --
.../storage/UpdateStorageRequestBinder.java | 47 --
.../ProfitBricksComputeServiceAdapter.java | 483 -------------------
.../compute/concurrent/ProvisioningJob.java | 62 ---
.../compute/concurrent/ProvisioningManager.java | 88 ----
...ProfitBricksComputeServiceContextModule.java | 223 ---------
.../compute/function/ProvisionableToImage.java | 241 ---------
.../compute/function/ServerToNodeMetadata.java | 168 -------
.../compute/function/StorageToVolume.java | 47 --
.../strategy/AssignDataCenterToTemplate.java | 110 -----
.../strategy/TemplateWithDataCenter.java | 107 ----
.../config/ProfitBricksComputeProperties.java | 32 --
.../config/ProfitBricksHttpApiModule.java | 70 ---
.../profitbricks/domain/AvailabilityZone.java | 32 --
.../jclouds/profitbricks/domain/DataCenter.java | 121 -----
.../org/jclouds/profitbricks/domain/Drive.java | 55 ---
.../jclouds/profitbricks/domain/Firewall.java | 188 --------
.../org/jclouds/profitbricks/domain/Image.java | 128 -----
.../jclouds/profitbricks/domain/IpBlock.java | 103 ----
.../profitbricks/domain/LoadBalancer.java | 257 ----------
.../jclouds/profitbricks/domain/Location.java | 60 ---
.../org/jclouds/profitbricks/domain/Nic.java | 248 ----------
.../org/jclouds/profitbricks/domain/OsType.java | 28 --
.../profitbricks/domain/Provisionable.java | 35 --
.../profitbricks/domain/ProvisioningState.java | 28 --
.../org/jclouds/profitbricks/domain/Server.java | 410 ----------------
.../profitbricks/domain/ServiceFault.java | 70 ---
.../jclouds/profitbricks/domain/Snapshot.java | 251 ----------
.../jclouds/profitbricks/domain/Storage.java | 234 ---------
.../profitbricks/features/DataCenterApi.java | 134 -----
.../profitbricks/features/DrivesApi.java | 51 --
.../profitbricks/features/FirewallApi.java | 93 ----
.../jclouds/profitbricks/features/ImageApi.java | 65 ---
.../profitbricks/features/IpBlockApi.java | 83 ----
.../profitbricks/features/LoadBalancerApi.java | 93 ----
.../jclouds/profitbricks/features/NicApi.java | 88 ----
.../profitbricks/features/ServerApi.java | 166 -------
.../profitbricks/features/SnapshotApi.java | 87 ----
.../profitbricks/features/StorageApi.java | 137 ------
.../handlers/ProfitBricksHttpErrorHandler.java | 75 ---
...usFromPayloadHttpCommandExecutorService.java | 140 ------
.../ProfitBricksSoapMessageEnvelope.java | 59 ---
.../parser/BaseProfitBricksResponseHandler.java | 68 ---
.../parser/RequestIdOnlyResponseHandler.java | 45 --
.../parser/ServiceFaultResponseHandler.java | 58 ---
.../BaseDataCenterResponseHandler.java | 38 --
.../DataCenterInfoResponseHandler.java | 110 -----
.../DataCenterListResponseHandler.java | 61 ---
.../firewall/BaseFirewallResponseHandler.java | 69 ---
.../firewall/FirewallListResponseHandler.java | 68 ---
.../firewall/FirewallResponseHandler.java | 63 ---
.../rule/BaseFirewallRuleResponseHandler.java | 54 ---
.../rule/FirewallRuleListResponseHandler.java | 54 ---
.../parser/image/BaseImageResponseHandler.java | 71 ---
.../parser/image/ImageInfoResponseHandler.java | 44 --
.../parser/image/ImageListResponseHandler.java | 49 --
.../ipblock/BaseIpBlockResponseHandler.java | 69 ---
.../ipblock/IpBlockListResponseHandler.java | 64 ---
.../parser/ipblock/IpBlockResponseHandler.java | 64 ---
.../BaseLoadBalancerResponseHandler.java | 114 -----
.../LoadBalancerIdOnlyResponseHandler.java | 51 --
.../LoadBalancerListResponseHandler.java | 79 ---
.../LoadBalancerResponseHandler.java | 68 ---
.../http/parser/nic/BaseNicResponseHandler.java | 87 ----
.../parser/nic/NicIdOnlyResponseHandler.java | 51 --
.../http/parser/nic/NicListResponseHandler.java | 73 ---
.../http/parser/nic/NicResponseHandler.java | 63 ---
.../publicip/BasePublicIpResponseHandler.java | 38 --
.../publicip/PublicIpListResponseHandler.java | 53 --
.../server/BaseServerResponseHandler.java | 136 ------
.../server/ServerIdOnlyResponseHandler.java | 51 --
.../server/ServerInfoResponseHandler.java | 69 ---
.../server/ServerListResponseHandler.java | 89 ----
.../snapshot/BaseSnapshotResponseHandler.java | 83 ----
.../snapshot/SnapshotListResponseHandler.java | 54 ---
.../snapshot/SnapshotResponseHandler.java | 49 --
.../GetProvisioningStateResponseHandler.java | 47 --
.../storage/BaseStorageResponseHandler.java | 81 ----
.../storage/StorageIdOnlyResponseHandler.java | 46 --
.../storage/StorageInfoResponseHandler.java | 51 --
.../storage/StorageListResponseHandler.java | 61 ---
.../jclouds/profitbricks/util/MacAddresses.java | 29 --
.../jclouds/profitbricks/util/Passwords.java | 64 ---
.../profitbricks/util/Preconditions.java | 100 ----
.../profitbricks/BaseProfitBricksLiveTest.java | 186 -------
.../ProfitBricksProviderMetadataTest.java | 29 --
.../CreateDataCenterRequestBinderTest.java | 47 --
.../UpdateDataCenterRequestBinderTest.java | 46 --
.../AddRomDriveToServerRequestBinderTest.java | 49 --
.../AddFirewallRuleToNicRequestBinderTest.java | 65 ---
.../binder/firewall/FirewallBinderTest.java | 131 -----
.../CreateLoadBalancerRequestBinderTest.java | 68 ---
...DeregisterLoadBalancerRequestBinderTest.java | 47 --
.../RegisterLoadBalancerRequestBinderTest.java | 46 --
.../UpdateLoadBalancerRequestBinderTest.java | 61 ---
.../binder/nic/CreateNicRequestBinderTest.java | 53 --
.../binder/nic/SetInternetAccessBinderTest.java | 48 --
.../binder/nic/UpdateNicRequestBinderTest.java | 54 ---
.../server/CreateServerRequestBinderTest.java | 65 ---
.../server/UpdateServerRequestBinderTest.java | 64 ---
.../CreateSnapshotRequestBinderTest.java | 51 --
.../RollbackSnapshotRequestBinderTest.java | 44 --
.../UpdateSnapshotRequestBinderTest.java | 74 ---
...ConnectStorageToServerRequestBinderTest.java | 55 ---
.../storage/CreateStorageRequestBinderTest.java | 56 ---
.../storage/UpdateStorageRequestBinderTest.java | 53 --
.../ProfitBricksComputeServiceLiveTest.java | 73 ---
.../ProfitBricksTemplateBuilderLiveTest.java | 103 ----
.../concurrent/ProvisioningManagerTest.java | 118 -----
.../compute/config/StatusPredicateTest.java | 145 ------
.../function/ProvisionableToImageTest.java | 271 -----------
.../function/ServerToNodeMetadataTest.java | 204 --------
.../compute/function/StorageToVolumeTest.java | 61 ---
.../domain/FirewallRuleBuilderTest.java | 82 ----
.../profitbricks/domain/ServerBuilderTest.java | 162 -------
.../features/DataCenterApiLiveTest.java | 123 -----
.../features/DataCenterApiMockTest.java | 271 -----------
.../features/DrivesApiLiveTest.java | 77 ---
.../features/DrivesApiMockTest.java | 81 ----
.../features/FirewallApiLiveTest.java | 139 ------
.../features/FirewallApiMockTest.java | 324 -------------
.../profitbricks/features/ImageApiLiveTest.java | 62 ---
.../profitbricks/features/ImageApiMockTest.java | 116 -----
.../features/IpBlockApiLiveTest.java | 111 -----
.../features/IpBlockApiMockTest.java | 200 --------
.../features/LoadBalancerApiLiveTest.java | 157 ------
.../features/LoadBalancerApiMockTest.java | 285 -----------
.../profitbricks/features/NicApiLiveTest.java | 124 -----
.../profitbricks/features/NicApiMockTest.java | 237 ---------
.../features/ServerApiLiveTest.java | 129 -----
.../features/ServerApiMockTest.java | 363 --------------
.../features/SnapshotApiLiveTest.java | 168 -------
.../features/SnapshotApiMockTest.java | 268 ----------
.../features/StorageApiLiveTest.java | 150 ------
.../features/StorageApiMockTest.java | 285 -----------
...omPayloadHttpCommandExecutorServiceTest.java | 149 ------
.../ProfitBricksSoapMessageEnvelopeTest.java | 57 ---
.../http/parser/BaseResponseHandlerTest.java | 61 ---
.../RequestIdOnlyResponseHandlerTest.java | 76 ---
.../parser/ServiceFaultResponseHandlerTest.java | 49 --
.../DataCenterInfoResponseHandlerTest.java | 142 ------
.../DataCenterListResponseHandlerTest.java | 53 --
.../FirewallListResponseHandlerTest.java | 87 ----
.../firewall/FirewallResponseHandlerTest.java | 71 ---
.../image/ImageInfoResponseHandlerTest.java | 65 ---
.../image/ImageListResponseHandlerTest.java | 183 -------
.../ipblock/IpBlockListResponseHandlerTest.java | 76 ---
.../ipblock/IpBlockResponseHandlerTest.java | 62 ---
.../LoadBalancerIdOnlyResponseHandlerTest.java | 41 --
.../LoadBalancerListResponseHandlerTest.java | 124 -----
.../LoadBalancerResponseHandlerTest.java | 99 ----
.../nic/NicIdOnlyResponseHandlerTest.java | 40 --
.../parser/nic/NicListResponseHandlerTest.java | 95 ----
.../http/parser/nic/NicResponseHandlerTest.java | 68 ---
.../server/ServerIdOnlyResponseHandlerTest.java | 40 --
.../server/ServerInfoResponseHandlerTest.java | 119 -----
.../server/ServerListResponseHandlerTest.java | 182 -------
.../SnapshotListResponseHandlerTest.java | 103 ----
.../snapshot/SnapshotResponseHandlerTest.java | 77 ---
...GetProvisioningStateResponseHandlerTest.java | 110 -----
.../StorageIdOnlyResponseHandlerTest.java | 42 --
.../storage/StorageInfoResponseHandlerTest.java | 65 ---
.../storage/StorageListResponseHandlerTest.java | 79 ---
.../internal/BaseProfitBricksMockTest.java | 104 ----
.../profitbricks/util/MacAddressesTest.java | 45 --
.../profitbricks/util/PasswordsTest.java | 53 --
.../resources/datacenter/datacenter-cleared.xml | 12 -
.../resources/datacenter/datacenter-created.xml | 13 -
.../resources/datacenter/datacenter-deleted.xml | 10 -
.../datacenter/datacenter-not-found.xml | 17 -
.../datacenter/datacenter-state-inprocess.xml | 8 -
.../resources/datacenter/datacenter-state.xml | 8 -
.../resources/datacenter/datacenter-updated.xml | 12 -
.../test/resources/datacenter/datacenter.xml | 79 ---
.../test/resources/datacenter/datacenters.xml | 19 -
.../src/test/resources/drives/drives-add.xml | 12 -
.../src/test/resources/drives/drives-remove.xml | 12 -
profitbricks/src/test/resources/fault-400.xml | 17 -
profitbricks/src/test/resources/fault-401.html | 43 --
profitbricks/src/test/resources/fault-404.xml | 17 -
profitbricks/src/test/resources/fault-413.xml | 17 -
.../resources/firewall/firewall-activate.xml | 12 -
.../resources/firewall/firewall-addtonic.xml | 23 -
.../resources/firewall/firewall-deactivate.xml | 12 -
.../test/resources/firewall/firewall-delete.xml | 12 -
.../test/resources/firewall/firewall-remove.xml | 12 -
.../src/test/resources/firewall/firewall.xml | 23 -
.../src/test/resources/firewall/firewalls.xml | 39 --
.../test/resources/image/image-not-found.xml | 17 -
profitbricks/src/test/resources/image/image.xml | 26 -
.../src/test/resources/image/images.xml | 140 ------
.../test/resources/ipblock/ipblock-addtonic.xml | 12 -
.../test/resources/ipblock/ipblock-release.xml | 10 -
.../resources/ipblock/ipblock-removefromnic.xml | 12 -
.../test/resources/ipblock/ipblock-reserve.xml | 13 -
.../src/test/resources/ipblock/ipblock.xml | 18 -
.../src/test/resources/ipblock/ipblocks.xml | 30 --
.../loadbalancer/loadbalancer-create.xml | 13 -
.../loadbalancer/loadbalancer-delete.xml | 12 -
.../loadbalancer/loadbalancer-deregister.xml | 12 -
.../loadbalancer/loadbalancer-register.xml | 19 -
.../loadbalancer/loadbalancer-update.xml | 12 -
.../resources/loadbalancer/loadbalancer.xml | 32 --
.../resources/loadbalancer/loadbalancers.xml | 57 ---
.../src/test/resources/logback-test.xml | 74 ---
.../src/test/resources/maintenance-503.html | 67 ---
.../src/test/resources/nic/nic-create.xml | 13 -
.../src/test/resources/nic/nic-delete.xml | 12 -
.../test/resources/nic/nic-internetaccess.xml | 12 -
.../src/test/resources/nic/nic-update.xml | 12 -
profitbricks/src/test/resources/nic/nic.xml | 27 --
profitbricks/src/test/resources/nic/nics.xml | 49 --
.../src/test/resources/server/server-create.xml | 13 -
.../src/test/resources/server/server-delete.xml | 13 -
.../src/test/resources/server/server-reset.xml | 11 -
.../src/test/resources/server/server-start.xml | 11 -
.../resources/server/server-state-inprocess.xml | 28 --
.../src/test/resources/server/server-stop.xml | 11 -
.../src/test/resources/server/server-update.xml | 13 -
.../src/test/resources/server/server.xml | 59 ---
.../src/test/resources/server/servers.xml | 109 -----
.../test/resources/snapshot/snapshot-create.xml | 11 -
.../test/resources/snapshot/snapshot-delete.xml | 10 -
.../resources/snapshot/snapshot-rollback.xml | 12 -
.../snapshot/snapshot-state-inprocess.xml | 27 --
.../test/resources/snapshot/snapshot-update.xml | 10 -
.../src/test/resources/snapshot/snapshot.xml | 27 --
.../src/test/resources/snapshot/snapshots.xml | 47 --
.../test/resources/storage/storage-connect.xml | 13 -
.../test/resources/storage/storage-create.xml | 14 -
.../test/resources/storage/storage-delete.xml | 13 -
.../resources/storage/storage-disconnect.xml | 13 -
.../storage/storage-state-inprocess.xml | 23 -
.../test/resources/storage/storage-update.xml | 13 -
.../src/test/resources/storage/storage.xml | 23 -
.../src/test/resources/storage/storages.xml | 37 --
261 files changed, 20012 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 2cb87e3..dba26ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,7 +80,6 @@
<module>joyent-cloudapi</module>
<module>joyentcloud</module>
<module>abiquo</module>
- <module>profitbricks</module>
<module>profitbricks-rest</module>
</modules>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/README.md
----------------------------------------------------------------------
diff --git a/profitbricks/README.md b/profitbricks/README.md
deleted file mode 100644
index 67db8dd..0000000
--- a/profitbricks/README.md
+++ /dev/null
@@ -1,61 +0,0 @@
-# jclouds ProfitBricks
-
-## Terms
-Like any cloud provider, ProfitBricks has its own set of terms in cloud computing. To abstract this into jclouds' Compute interface, these terms were associated:
-
-- Node - composite instance of `Server` and `Storage`
-- Image - both *user-uploaded* and *provided* `Images`; and `Snapshots`
-- Location - `DataCenters` and `Region` (Las Vegas, Frankfurt, etc.)
-- Hardware - number of cores, RAM size and storage size
-
-## Getting Started
-
-Assuming that there's **atleast one** datacenter existing in your account, the provider needs only an *identity* (your ProfitBricks email), and *credentials* (password) to provision a `Node`, by using a ProfitBricks-provided ubuntu-12.04 image as a template.
-
-```java
-ComputeService compute = ContextBuilder.newBuilder( "profitbricks" )
- .credentials( "profitbricks email", "password" )
- .buildView( ComputeServiceContext.class )
- .getComputeService();
-```
-
-
-This works well; however, we won't be able to use jclouds' ability to execute *scripts* on a remote node. This is because, ProfitBricks' default images require users to change passwords upon first log in.
-
-To enable jclouds to execute script, we need to use a custom image. The easiest way to do this is via ProfitBricks snapshot:
-
-- Go to your [DCD](https://my.profitbricks.com/dashboard/).
-- Provision a server + storage, and connect it to the internet. Upon success, you will receive an email containing the credentials needed to login to your server.
-- Login to your server, and change the password, as requested.
-
-```
-~ ssh root@<remote-ip>
-...
-Changing password for root.
-(current) UNIX password:
-Enter new UNIX password:
-Retype new UNIX password:
-~ root@ubuntu:~# exit
-
-```
-
-- Go back to the DCD, and *make a snapshot* of the storage. Put a descriptive name.
-- Configure jclouds to use this *snapshot*.
-
-```java
-Template template = compute.templateBuilder()
- .imageNameMatches( "<ideally-unique-snapshot-name>" )
- .options( compute.templateOptions()
- .overrideLoginUser( "root" ) // unless you changed the user
- .overrideLoginPassword( "<changed-password>" ))
- // more options, as you need
- .build();
-
-compute.createNodesInGroup( "cluster1", 1, template );
-```
-
-## Limitations
-
-- There's no direct way of specifying arbitrary number of cores, RAM size, and storage size via the compute interface, at least until after [JCLOUDS-482](https://issues.apache.org/jira/browse/JCLOUDS-482) is resolved. The adapter uses a predefined list hardware profiles instead.
-
-> Take note that these features are still accessible by *unwraping* the ProfitBricks API, but this'll reduce portability of your code. See [Concepts](https://jclouds.apache.org/start/concepts/).
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/pom.xml
----------------------------------------------------------------------
diff --git a/profitbricks/pom.xml b/profitbricks/pom.xml
deleted file mode 100644
index 9311e48..0000000
--- a/profitbricks/pom.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.jclouds.labs</groupId>
- <artifactId>jclouds-labs</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
-
- <!-- TODO: when out of labs, switch to org.jclouds.api -->
- <artifactId>profitbricks</artifactId>
- <name>jclouds ProfitBricks api</name>
- <description>jclouds components to access an implementation of ProfitBricks</description>
- <packaging>bundle</packaging>
-
- <properties>
- <test.profitbricks.endpoint>https://api.profitbricks.com/1.3</test.profitbricks.endpoint>
- <test.profitbricks.identity>FIXME</test.profitbricks.identity>
- <test.profitbricks.credential>FIXME</test.profitbricks.credential>
- <test.profitbricks.api-version>1.3</test.profitbricks.api-version>
- <jclouds.osgi.export>org.jclouds.profitbricks*;version="${project.version}"</jclouds.osgi.export>
- <jclouds.osgi.import>
- org.jclouds.labs*;version="${project.version}",
- org.jclouds*;version="${jclouds.version}",
- *
- </jclouds.osgi.import>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-compute</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.auto.service</groupId>
- <artifactId>auto-service</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.auto.value</groupId>
- <artifactId>auto-value</artifactId>
- <scope>provided</scope>
- </dependency>
- <!-- Test dependencies -->
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${jclouds.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-compute</artifactId>
- <version>${jclouds.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-sshj</artifactId>
- <version>${jclouds.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.squareup.okhttp</groupId>
- <artifactId>mockwebserver</artifactId>
- <scope>test</scope>
- <exclusions>
- <!-- Already provided by jclouds-sshj -->
- <exclusion>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk15on</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-slf4j</artifactId>
- <version>${jclouds.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>live</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>integration</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <threadCount>1</threadCount>
- <systemPropertyVariables>
- <test.profitbricks.endpoint>${test.profitbricks.endpoint}</test.profitbricks.endpoint>
- <test.profitbricks.identity>${test.profitbricks.identity}</test.profitbricks.identity>
- <test.profitbricks.credential>${test.profitbricks.credential}</test.profitbricks.credential>
- <test.profitbricks.api-version>${test.profitbricks.api-version}</test.profitbricks.api-version>
- <test.profitbricks.template>${test.profitbricks.template}</test.profitbricks.template>
- </systemPropertyVariables>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 8755ed9..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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;
-
-import java.io.Closeable;
-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;
-import org.jclouds.profitbricks.features.StorageApi;
-import org.jclouds.rest.annotations.Delegate;
-
-public interface ProfitBricksApi extends Closeable {
-
- @Delegate
- DataCenterApi dataCenterApi();
-
- @Delegate
- ImageApi imageApi();
-
- @Delegate
- ServerApi serverApi();
-
- @Delegate
- StorageApi storageApi();
-
- @Delegate
- NicApi nicApi();
-
- @Delegate
- FirewallApi firewallApi();
-
- @Delegate
- SnapshotApi snapshotApi();
-
- @Delegate
- IpBlockApi ipBlockApi();
-
- @Delegate
- DrivesApi drivesApi();
-
- @Delegate
- LoadBalancerApi loadBalancerApi();
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApiMetadata.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApiMetadata.java b/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApiMetadata.java
deleted file mode 100644
index 2973f4a..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApiMetadata.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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;
-
-import java.net.URI;
-import java.util.Properties;
-
-import org.jclouds.profitbricks.compute.config.ProfitBricksComputeServiceContextModule;
-import org.jclouds.profitbricks.config.ProfitBricksHttpApiModule;
-import org.jclouds.apis.ApiMetadata;
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.profitbricks.config.ProfitBricksHttpApiModule.ProfitBricksHttpCommandExecutorServiceModule;
-import org.jclouds.rest.internal.BaseHttpApiMetadata;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
-/**
- * Implementation of {@link ApiMetadata} for ProfitBricks API.
- */
-public class ProfitBricksApiMetadata extends BaseHttpApiMetadata<ProfitBricksApi> {
-
- public ProfitBricksApiMetadata() {
- this(new Builder());
- }
-
- @Override
- public Builder toBuilder() {
- return new Builder().fromApiMetadata(this);
- }
-
- protected ProfitBricksApiMetadata(Builder builder) {
- super(builder);
- }
-
- public static Properties defaultProperties() {
- Properties properties = BaseHttpApiMetadata.defaultProperties();
- return properties;
- }
-
- public static class Builder extends BaseHttpApiMetadata.Builder<ProfitBricksApi, Builder> {
-
- protected Builder() {
- id("profitbricks")
- .name("ProfitBricks API")
- .identityName("API Username")
- .credentialName("API Password")
- .documentation(URI.create("https://www.profitbricks.com/sites/default/files/profitbricks_api_1_3.pdf"))
- .defaultEndpoint("https://api.profitbricks.com/1.3")
- .version("1.3")
- .view(ComputeServiceContext.class)
- .defaultProperties(ProfitBricksApiMetadata.defaultProperties())
- .defaultModules(ImmutableSet.<Class<? extends Module>>of(
- ProfitBricksHttpApiModule.class,
- ProfitBricksHttpCommandExecutorServiceModule.class,
- ProfitBricksComputeServiceContextModule.class
- ));
- }
-
- @Override
- public ProfitBricksApiMetadata build() {
- return new ProfitBricksApiMetadata(this);
- }
-
- @Override
- protected Builder self() {
- return this;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksProviderMetadata.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksProviderMetadata.java b/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksProviderMetadata.java
deleted file mode 100644
index ba8b9d4..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksProviderMetadata.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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;
-
-import static org.jclouds.Constants.PROPERTY_SO_TIMEOUT;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_SUSPENDED;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED;
-import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES;
-import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGION;
-import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
-import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONE;
-import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONES;
-import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.POLL_INITIAL_PERIOD;
-import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.POLL_MAX_PERIOD;
-import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.TIMEOUT_DATACENTER_AVAILABLE;
-
-import java.net.URI;
-import java.util.Properties;
-
-import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.providers.internal.BaseProviderMetadata;
-
-import com.google.auto.service.AutoService;
-
-@AutoService(ProviderMetadata.class)
-public class ProfitBricksProviderMetadata extends BaseProviderMetadata {
-
- public ProfitBricksProviderMetadata(Builder builder) {
- super(builder);
- }
-
- public ProfitBricksProviderMetadata() {
- super(builder());
- }
-
- @Override
- public Builder toBuilder() {
- return builder().fromProviderMetadata(this);
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static Properties defaultProperties() {
- Properties properties = ProfitBricksApiMetadata.defaultProperties();
-
- properties.setProperty(PROPERTY_REGIONS, "de,us");
- properties.setProperty(PROPERTY_REGION + ".de.zones", "de/fkb,de/fra");
- properties.setProperty(PROPERTY_REGION + ".us.zones", "us/las,us/lasdev");
- properties.setProperty(PROPERTY_ZONES, "de/fkb,de/fra,us/las,us/lasdev");
- properties.setProperty(PROPERTY_ZONE + ".de/fkb." + ISO3166_CODES, "DE-BW");
- properties.setProperty(PROPERTY_ZONE + ".de/fra." + ISO3166_CODES, "DE-HE");
- properties.setProperty(PROPERTY_ZONE + ".us/las." + ISO3166_CODES, "US-NV");
- properties.setProperty(PROPERTY_ZONE + ".us/lasdebv." + ISO3166_CODES, "US-NV");
-
- properties.put(TIMEOUT_DATACENTER_AVAILABLE, 30L * 60L); // 30 minutes
- properties.put(POLL_INITIAL_PERIOD, 5L);
- properties.put(POLL_MAX_PERIOD, 60L);
-
- properties.put("jclouds.ssh.max-retries", "7");
- properties.put("jclouds.ssh.retry-auth", "true");
-
- properties.put(PROPERTY_SO_TIMEOUT, 10 * 60 * 1000);
-
- // Node might still not be available even after DataCenter is done provisioning
- // Use 5-minute timeout by default
- properties.put(TIMEOUT_NODE_RUNNING, 5 * 60 * 1000);
- properties.put(TIMEOUT_NODE_SUSPENDED, 5 * 60 * 1000);
- properties.put(TIMEOUT_NODE_TERMINATED, 5 * 60 * 1000);
-
- return properties;
- }
-
- public static class Builder extends BaseProviderMetadata.Builder {
-
- protected Builder() {
- id("profitbricks")
- .name("ProfitBricks Cloud Compute 2.0")
- .homepage(URI.create("http://www.profitbricks.com"))
- .console(URI.create("https://my.profitbricks.com/dashboard/dcdr2/"))
- .iso3166Codes("DE-BW", "DE-HE", "US-NV")
- .linkedServices("profitbricks")
- .apiMetadata(new ProfitBricksApiMetadata())
- .defaultProperties(ProfitBricksProviderMetadata.defaultProperties());
- }
-
- @Override
- public ProfitBricksProviderMetadata build() {
- return new ProfitBricksProviderMetadata(this);
- }
-
- @Override
- public Builder fromProviderMetadata(ProviderMetadata in) {
- super.fromProviderMetadata(in);
- return this;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/BaseProfitBricksRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/BaseProfitBricksRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/BaseProfitBricksRequestBinder.java
deleted file mode 100644
index 2b842ff..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/BaseProfitBricksRequestBinder.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-
-import com.google.common.base.Strings;
-
-import org.jclouds.io.MutableContentMetadata;
-import org.jclouds.io.payloads.BaseMutableContentMetadata;
-
-public abstract class BaseProfitBricksRequestBinder<T> implements MapBinder {
-
- protected final String paramName;
-
- protected BaseProfitBricksRequestBinder(String paramName) {
- this.paramName = checkNotNull(paramName, "Initialize 'paramName' in constructor");
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
- checkNotNull(request, "request");
-
- Object obj = checkNotNull(postParams.get(paramName), "Param '%s' cannot be null.", paramName);
- T payload = (T) obj;
-
- return createRequest(request, createPayload(payload));
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- protected abstract String createPayload(T payload);
-
- protected static String formatIfNotEmpty(String pattern, Object param) {
- return Strings.isNullOrEmpty(nullableToString(param)) ? "" : String.format(pattern, param);
- }
-
- protected static String nullableToString(Object object) {
- return object == null ? "" : object.toString();
- }
-
- protected <R extends HttpRequest> R createRequest(R fromRequest, String payload) {
- MutableContentMetadata metadata = new BaseMutableContentMetadata();
- metadata.setContentType(MediaType.TEXT_XML);
- metadata.setContentLength(Long.valueOf(payload.getBytes().length));
-
- fromRequest.setPayload(payload);
- fromRequest.getPayload().setContentMetadata(metadata);
- return fromRequest;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/CreateDataCenterRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/CreateDataCenterRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/CreateDataCenterRequestBinder.java
deleted file mode 100644
index 1873f31..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/CreateDataCenterRequestBinder.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.datacenter;
-
-import static java.lang.String.format;
-
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-import org.jclouds.profitbricks.domain.DataCenter;
-
-public class CreateDataCenterRequestBinder extends BaseProfitBricksRequestBinder<DataCenter.Request.CreatePayload> {
-
- protected final StringBuilder requestBuilder;
-
- CreateDataCenterRequestBinder() {
- super("dataCenter");
- this.requestBuilder = new StringBuilder(128);
- }
-
- @Override
- protected String createPayload(DataCenter.Request.CreatePayload payload) {
- requestBuilder.append("<ws:createDataCenter>")
- .append("<request>")
- .append(format("<dataCenterName>%s</dataCenterName>", payload.name()))
- .append(format("<location>%s</location>", payload.location().getId()))
- .append("</request>")
- .append("</ws:createDataCenter>");
- return requestBuilder.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/UpdateDataCenterRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/UpdateDataCenterRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/UpdateDataCenterRequestBinder.java
deleted file mode 100644
index 920e9bf..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/UpdateDataCenterRequestBinder.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.datacenter;
-
-import static java.lang.String.format;
-
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-import org.jclouds.profitbricks.domain.DataCenter;
-
-public class UpdateDataCenterRequestBinder extends BaseProfitBricksRequestBinder<DataCenter.Request.UpdatePayload> {
-
- protected final StringBuilder requestBuilder;
-
- UpdateDataCenterRequestBinder() {
- super("dataCenter");
- this.requestBuilder = new StringBuilder(128);
- }
-
- @Override
- protected String createPayload(DataCenter.Request.UpdatePayload payload) {
- requestBuilder.append("<ws:updateDataCenter>")
- .append("<request>")
- .append(format("<dataCenterId>%s</dataCenterId>", payload.id()))
- .append(format("<dataCenterName>%s</dataCenterName>", payload.name()))
- .append("</request>")
- .append("</ws:updateDataCenter>");
- return requestBuilder.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/drive/AddRomDriveToServerRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/drive/AddRomDriveToServerRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/drive/AddRomDriveToServerRequestBinder.java
deleted file mode 100644
index 3a931ab..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/drive/AddRomDriveToServerRequestBinder.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.drive;
-
-import static java.lang.String.format;
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-import org.jclouds.profitbricks.domain.Drive;
-
-public class AddRomDriveToServerRequestBinder extends BaseProfitBricksRequestBinder<Drive.Request.AddRomDriveToServerPayload> {
-
- private final StringBuilder requestBuilder;
-
- AddRomDriveToServerRequestBinder() {
- super("payload");
- this.requestBuilder = new StringBuilder(128);
- }
-
- @Override
- protected String createPayload(Drive.Request.AddRomDriveToServerPayload payload) {
- requestBuilder.append("<ws:addRomDriveToServer>")
- .append("<request>")
- .append(format("<imageId>%s</imageId>", payload.imageId()))
- .append(format("<serverId>%s</serverId>", payload.serverId()))
- .append(formatIfNotEmpty("<deviceNumber>%s</deviceNumber>", payload.deviceNumber()))
- .append("</request>")
- .append("</ws:addRomDriveToServer>");
-
- return requestBuilder.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/AddFirewallRuleToNicRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/AddFirewallRuleToNicRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/AddFirewallRuleToNicRequestBinder.java
deleted file mode 100644
index 8f4db03..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/AddFirewallRuleToNicRequestBinder.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.firewall;
-
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-import org.jclouds.profitbricks.domain.Firewall;
-import static java.lang.String.format;
-
-public class AddFirewallRuleToNicRequestBinder extends BaseProfitBricksRequestBinder<Firewall.Request.AddRulePayload> {
-
- private final StringBuilder requestBuilder;
-
- AddFirewallRuleToNicRequestBinder() {
- super("firewall");
- this.requestBuilder = new StringBuilder(128);
- }
-
- @Override
- protected String createPayload(Firewall.Request.AddRulePayload payload) {
- requestBuilder.append("<ws:addFirewallRulesToNic>")
- .append(format("<nicId>%s</nicId>", payload.nicId()));
- for (Firewall.Rule rule : payload.rules())
- requestBuilder
- .append("<request>")
- .append(formatIfNotEmpty("<icmpCode>%s</icmpCode>", rule.icmpCode()))
- .append(formatIfNotEmpty("<icmpType>%s</icmpType>", rule.icmpType()))
- .append(formatIfNotEmpty("<name>%s</name>", rule.name()))
- .append(formatIfNotEmpty("<portRangeEnd>%s</portRangeEnd>", rule.portRangeEnd()))
- .append(formatIfNotEmpty("<portRangeStart>%s</portRangeStart>", rule.portRangeStart()))
- .append(formatIfNotEmpty("<protocol>%s</protocol>", rule.protocol()))
- .append(formatIfNotEmpty("<sourceIp>%s</sourceIp>", rule.sourceIp()))
- .append(formatIfNotEmpty("<sourceMac>%s</sourceMac>", rule.sourceMac()))
- .append(formatIfNotEmpty("<targetIp>%s</targetIp>", rule.targetIp()))
- .append("</request>");
- requestBuilder.append("</ws:addFirewallRulesToNic>");
- return requestBuilder.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/FirewallBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/FirewallBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/FirewallBinder.java
deleted file mode 100644
index a1f03c2..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/FirewallBinder.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.firewall;
-
-import static java.lang.String.format;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-
-import com.google.common.base.Strings;
-
-public abstract class FirewallBinder extends BaseProfitBricksRequestBinder<List<String>> {
-
- protected final StringBuilder requestBuilder;
-
- FirewallBinder() {
- super("ids");
- this.requestBuilder = new StringBuilder(128);
- }
-
- protected void bindListWithTag(List<String> ids, String tag) {
- if (ids == null || ids.isEmpty() || Strings.isNullOrEmpty(tag))
- return;
- for (String id : ids)
- requestBuilder.append(format("<%s>%s</%s>", tag, id, tag));
- }
-
- public static class ActivateFirewallRequestBinder extends FirewallBinder {
-
- @Override
- protected String createPayload(List<String> payload) {
- requestBuilder.append("<ws:activateFirewalls>");
- bindListWithTag(payload, "firewallIds");
- requestBuilder.append("</ws:activateFirewalls>");
-
- return requestBuilder.toString();
- }
-
- }
-
- public static class DeactivateFirewallRequestBinder extends FirewallBinder {
-
- @Override
- protected String createPayload(List<String> payload) {
- requestBuilder.append("<ws:deactivateFirewalls>");
- bindListWithTag(payload, "firewallIds");
- requestBuilder.append("</ws:deactivateFirewalls>");
-
- return requestBuilder.toString();
- }
-
- }
-
- public static class DeleteFirewallRequestBinder extends FirewallBinder {
-
- @Override
- protected String createPayload(List<String> payload) {
- requestBuilder.append("<ws:deleteFirewalls>");
- bindListWithTag(payload, "firewallIds");
- requestBuilder.append("</ws:deleteFirewalls>");
-
- return requestBuilder.toString();
- }
-
- }
-
- public static class RemoveFirewallRuleRequestBinder extends FirewallBinder {
-
- @Override
- protected String createPayload(List<String> payload) {
- requestBuilder.append("<ws:removeFirewallRules>");
- bindListWithTag(payload, "firewallRuleIds");
- requestBuilder.append("</ws:removeFirewallRules>");
-
- return requestBuilder.toString();
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index e3d13a1..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/CreateLoadBalancerRequestBinder.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.name()))
- .append(format("<loadBalancerAlgorithm>%s</loadBalancerAlgorithm>", payload.algorithm()))
- .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/93aff921/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
deleted file mode 100644
index 086fa3d..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinder.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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>");
- for (String s : payload.serverIds())
- requestBuilder.append(format("<serverIds>%s</serverIds>", s));
- requestBuilder.append(format("<loadBalancerId>%s</loadBalancerId>", payload.id()))
- .append("</ws:deregisterServersOnLoadBalancer>");
-
- return requestBuilder.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 3741dad..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinder.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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(format("<loadBalancerId>%s</loadBalancerId>", payload.id()));
-
- for (String s : payload.serverIds())
- requestBuilder.append(format("<serverIds>%s</serverIds>", s));
- requestBuilder.append("</ws:registerServersOnLoadBalancer>");
-
- return requestBuilder.toString().replaceAll("\\s+", "");
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index c093f23..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/UpdateLoadBalancerRequestBinder.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.algorithm()))
- .append(formatIfNotEmpty("<ip>%s</ip>", payload.ip()))
- .append("</request>")
- .append("</ws:updateLoadBalancer>").toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/CreateNicRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/CreateNicRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/CreateNicRequestBinder.java
deleted file mode 100644
index f7dbdb3..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/CreateNicRequestBinder.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.nic;
-
-import static java.lang.String.format;
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-import org.jclouds.profitbricks.domain.Nic;
-
-public class CreateNicRequestBinder extends BaseProfitBricksRequestBinder<Nic.Request.CreatePayload> {
-
- private final StringBuilder requestBuilder;
-
- CreateNicRequestBinder() {
- super("nic");
- this.requestBuilder = new StringBuilder(128 * 2);
- }
-
- @Override
- protected String createPayload(Nic.Request.CreatePayload payload) {
- requestBuilder.append("<ws:createNic>")
- .append("<request>")
- .append(formatIfNotEmpty("<ip>%s</ip>", payload.ip()))
- .append(formatIfNotEmpty("<nicName>%s</nicName>", payload.name()))
- .append(formatIfNotEmpty("<dhcpActive>%s</dhcpActive>", payload.dhcpActive()))
- .append(format("<serverId>%s</serverId>", payload.serverId()))
- .append(format("<lanId>%s</lanId>", payload.lanId()))
- .append("</request>")
- .append("</ws:createNic>");
- return requestBuilder.toString();
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/SetInternetAccessBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/SetInternetAccessBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/SetInternetAccessBinder.java
deleted file mode 100644
index acdc809..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/SetInternetAccessBinder.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.nic;
-
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-import org.jclouds.profitbricks.domain.Nic;
-
-import static java.lang.String.format;
-
-public class SetInternetAccessBinder extends BaseProfitBricksRequestBinder<Nic.Request.SetInternetAccessPayload> {
-
- private final StringBuilder requestBuilder;
-
- SetInternetAccessBinder() {
- super("nic");
- this.requestBuilder = new StringBuilder(128);
- }
-
- @Override
- protected String createPayload(Nic.Request.SetInternetAccessPayload payload) {
- requestBuilder.append("<ws:setInternetAccess>")
- .append(format("<dataCenterId>%s</dataCenterId>", payload.dataCenterId()))
- .append(format("<lanId>%s</lanId>", payload.lanId()))
- .append(format("<internetAccess>%s</internetAccess>", payload.internetAccess()))
- .append("</ws:setInternetAccess>");
- return requestBuilder.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/UpdateNicRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/UpdateNicRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/UpdateNicRequestBinder.java
deleted file mode 100644
index f1e9d83..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/UpdateNicRequestBinder.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.nic;
-
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-import org.jclouds.profitbricks.domain.Nic;
-
-import static java.lang.String.format;
-
-public class UpdateNicRequestBinder extends BaseProfitBricksRequestBinder<Nic.Request.UpdatePayload> {
-
- private final StringBuilder requestBuilder;
-
- UpdateNicRequestBinder() {
- super("nic");
- this.requestBuilder = new StringBuilder(128 * 2);
- }
-
- @Override
- protected String createPayload(Nic.Request.UpdatePayload payload) {
- requestBuilder.append("<ws:updateNic>")
- .append("<request>")
- .append(format("<nicId>%s</nicId>", payload.id()))
- .append(formatIfNotEmpty("<ip>%s</ip>", payload.ip()))
- .append(formatIfNotEmpty("<nicName>%s</nicName>", payload.name()))
- .append(formatIfNotEmpty("<dhcpActive>%s</dhcpActive>", payload.dhcpActive()))
- .append(formatIfNotEmpty("<lanId>%s</lanId>", payload.lanId()))
- .append("</request>")
- .append("</ws:updateNic>");
- return requestBuilder.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/CreateServerRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/CreateServerRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/CreateServerRequestBinder.java
deleted file mode 100644
index b836ceb..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/CreateServerRequestBinder.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.server;
-
-import static java.lang.String.format;
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-import org.jclouds.profitbricks.domain.Server;
-
-public class CreateServerRequestBinder extends BaseProfitBricksRequestBinder<Server.Request.CreatePayload> {
-
- protected final StringBuilder requestBuilder;
-
- CreateServerRequestBinder() {
- super("server");
- this.requestBuilder = new StringBuilder(128 * 4);
- }
-
- @Override
- protected String createPayload(Server.Request.CreatePayload payload) {
- requestBuilder.append("<ws:createServer>")
- .append("<request>")
- .append(format("<dataCenterId>%s</dataCenterId>", payload.dataCenterId()))
- .append(format("<cores>%s</cores>", payload.cores()))
- .append(format("<ram>%s</ram>", payload.ram()))
- .append(formatIfNotEmpty("<serverName>%s</serverName>", payload.name()))
- .append(formatIfNotEmpty("<bootFromStorageId>%s</bootFromStorageId>", payload.bootFromStorageId()))
- .append(formatIfNotEmpty("<bootFromImageId>%s</bootFromImageId>", payload.bootFromImageId()))
- .append(formatIfNotEmpty("<internetAccess>%s</internetAccess>", payload.hasInternetAccess()))
- .append(formatIfNotEmpty("<lanId>%s</lanId>", payload.lanId()))
- .append(formatIfNotEmpty("<osType>%s</osType>", payload.osType()))
- .append(formatIfNotEmpty("<availabilityZone>%s</availabilityZone>", payload.availabilityZone()))
- .append(formatIfNotEmpty("<cpuHotPlug>%s</cpuHotPlug>", payload.isCpuHotPlug()))
- .append(formatIfNotEmpty("<ramHotPlug>%s</ramHotPlug>", payload.isRamHotPlug()))
- .append(formatIfNotEmpty("<nicHotPlug>%s</nicHotPlug>", payload.isNicHotPlug()))
- .append(formatIfNotEmpty("<nicHotUnPlug>%s</nicHotUnPlug>", payload.isNicHotUnPlug()))
- .append(formatIfNotEmpty("<discVirtioHotPlug>%s</discVirtioHotPlug>", payload.isDiscVirtioHotPlug()))
- .append(formatIfNotEmpty("<discVirtioHotUnPlug>%s</discVirtioHotUnPlug>", payload.isDiscVirtioHotUnPlug()))
- .append("</request>")
- .append("</ws:createServer>");
- return requestBuilder.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/UpdateServerRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/UpdateServerRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/UpdateServerRequestBinder.java
deleted file mode 100644
index c12ae21..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/UpdateServerRequestBinder.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.server;
-
-import static java.lang.String.format;
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-import org.jclouds.profitbricks.domain.Server;
-
-public class UpdateServerRequestBinder extends BaseProfitBricksRequestBinder<Server.Request.UpdatePayload> {
-
- protected final StringBuilder requestBuilder;
-
- UpdateServerRequestBinder() {
- super("server");
- this.requestBuilder = new StringBuilder(128 * 4);
-
- }
-
- @Override
- protected String createPayload(Server.Request.UpdatePayload payload) {
- requestBuilder.append("<ws:updateServer>")
- .append("<request>")
- .append(format("<serverId>%s</serverId>", payload.id()))
- .append(format("<cores>%s</cores>", payload.cores()))
- .append(format("<ram>%s</ram>", payload.ram()))
- .append(formatIfNotEmpty("<serverName>%s</serverName>", payload.name()))
- .append(formatIfNotEmpty("<bootFromStorageId>%s</bootFromStorageId>", payload.bootFromStorageId()))
- .append(formatIfNotEmpty("<bootFromImageId>%s</bootFromImageId>", payload.bootFromImageId()))
- .append(formatIfNotEmpty("<osType>%s</osType>", payload.osType()))
- .append(formatIfNotEmpty("<availabilityZone>%s</availabilityZone>", payload.availabilityZone()))
- .append(formatIfNotEmpty("<cpuHotPlug>%s</cpuHotPlug>", payload.isCpuHotPlug()))
- .append(formatIfNotEmpty("<ramHotPlug>%s</ramHotPlug>", payload.isRamHotPlug()))
- .append(formatIfNotEmpty("<nicHotPlug>%s</nicHotPlug>", payload.isNicHotPlug()))
- .append(formatIfNotEmpty("<nicHotUnPlug>%s</nicHotUnPlug>", payload.isNicHotUnPlug()))
- .append(formatIfNotEmpty("<discVirtioHotPlug>%s</discVirtioHotPlug>", payload.isDiscVirtioHotPlug()))
- .append(formatIfNotEmpty("<discVirtioHotUnPlug>%s</discVirtioHotUnPlug>", payload.isDiscVirtioHotUnPlug()))
- .append("</request>")
- .append("</ws:updateServer>");
- return requestBuilder.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/CreateSnapshotRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/CreateSnapshotRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/CreateSnapshotRequestBinder.java
deleted file mode 100644
index 5ec4644..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/CreateSnapshotRequestBinder.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.snapshot;
-
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-import org.jclouds.profitbricks.domain.Snapshot;
-
-import static java.lang.String.format;
-
-public class CreateSnapshotRequestBinder extends BaseProfitBricksRequestBinder<Snapshot.Request.CreatePayload> {
-
- protected final StringBuilder requestBuilder;
-
- protected CreateSnapshotRequestBinder() {
- super("snapshot");
- this.requestBuilder = new StringBuilder(128);
- }
-
- @Override
- protected String createPayload(Snapshot.Request.CreatePayload payload) {
- requestBuilder.append("<ws:createSnapshot>")
- .append("<request>")
- .append(format("<storageId>%s</storageId>", payload.storageId()))
- .append(formatIfNotEmpty("<description>%s</description>", payload.description()))
- .append(formatIfNotEmpty("<snapshotName>%s</snapshotName>", payload.name()))
- .append("</request>")
- .append("</ws:createSnapshot>");
- return requestBuilder.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/RollbackSnapshotRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/RollbackSnapshotRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/RollbackSnapshotRequestBinder.java
deleted file mode 100644
index 5099324..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/RollbackSnapshotRequestBinder.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.snapshot;
-
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-import org.jclouds.profitbricks.domain.Snapshot;
-
-import static java.lang.String.format;
-
-public class RollbackSnapshotRequestBinder extends BaseProfitBricksRequestBinder<Snapshot.Request.RollbackPayload> {
-
- protected final StringBuilder requestBuilder;
-
- protected RollbackSnapshotRequestBinder() {
- super("snapshot");
- this.requestBuilder = new StringBuilder(128);
- }
-
- @Override
- protected String createPayload(Snapshot.Request.RollbackPayload payload) {
- requestBuilder.append("<ws:rollbackSnapshot>")
- .append("<request>")
- .append(format("<snapshotId>%s</snapshotId>", payload.snapshotId()))
- .append(format("<storageId>%s</storageId>", payload.storageId()))
- .append("</request>")
- .append("</ws:rollbackSnapshot>");
- return requestBuilder.toString();
- }
-}
[08/11] jclouds-labs git commit: Remove ProfitBricks
Posted by de...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/features/IpBlockApi.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/features/IpBlockApi.java b/profitbricks/src/main/java/org/jclouds/profitbricks/features/IpBlockApi.java
deleted file mode 100644
index ca9841d..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/features/IpBlockApi.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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 java.util.List;
-
-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 org.jclouds.Fallbacks;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.profitbricks.domain.IpBlock;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.http.filters.ProfitBricksSoapMessageEnvelope;
-import org.jclouds.profitbricks.http.parser.RequestIdOnlyResponseHandler;
-import org.jclouds.profitbricks.http.parser.ipblock.IpBlockListResponseHandler;
-import org.jclouds.profitbricks.http.parser.ipblock.IpBlockResponseHandler;
-import org.jclouds.rest.annotations.Fallback;
-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 IpBlockApi {
-
- @POST
- @Named("publicipblock:get")
- @Payload("<ws:getPublicIpBlock><blockId>{id}</blockId></ws:getPublicIpBlock>")
- @XMLResponseParser(IpBlockResponseHandler.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- IpBlock getIpBlock(@PayloadParam("id") String identifier);
-
- @POST
- @Named("publicipblock:getall")
- @Payload("<ws:getAllPublicIpBlocks />")
- @XMLResponseParser(IpBlockListResponseHandler.class)
- @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
- List<IpBlock> getAllIpBlock();
-
- @POST
- @Named("publicipblock:reserve")
- @Payload("<ws:reservePublicIpBlock><request><blockSize>{blockSize}</blockSize><location>{location}</location></request></ws:reservePublicIpBlock>")
- @XMLResponseParser(IpBlockResponseHandler.class)
- IpBlock reservePublicIpBlock(@PayloadParam("blockSize") int blockSize, @PayloadParam("location") Location location);
-
- @POST
- @Named("publicipblock:addip")
- @Payload("<ws:addPublicIpToNic><ip>{ip}</ip><nicId>{nicid}</nicId></ws:addPublicIpToNic>")
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String addPublicIpToNic(@PayloadParam("ip") String ip, @PayloadParam("nicid") String nicid);
-
- @POST
- @Named("publicipblock:removeip")
- @Payload("<ws:removePublicIpFromNic><ip>{ip}</ip><nicId>{nicid}</nicId></ws:removePublicIpFromNic>")
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String removePublicIpFromNic(@PayloadParam("ip") String ip, @PayloadParam("nicid") String nicid);
-
- @POST
- @Named("publicipblock:releaseblock")
- @Payload("<ws:releasePublicIpBlock><blockId>{blockid}</blockId></ws:releasePublicIpBlock>")
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String releasePublicIpBlock(@PayloadParam("blockid") String blockid);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 6cf8e23..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/features/LoadBalancerApi.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.LoadBalancerIdOnlyResponseHandler;
-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(LoadBalancerIdOnlyResponseHandler.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(RequestIdOnlyResponseHandler.class)
- String 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(RequestIdOnlyResponseHandler.class)
- String updateLoadBalancer(@PayloadParam("loadbalancer") LoadBalancer.Request.UpdatePayload payload);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/features/NicApi.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/features/NicApi.java b/profitbricks/src/main/java/org/jclouds/profitbricks/features/NicApi.java
deleted file mode 100644
index c945935..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/features/NicApi.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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 org.jclouds.Fallbacks;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.profitbricks.binder.nic.CreateNicRequestBinder;
-import org.jclouds.profitbricks.binder.nic.SetInternetAccessBinder;
-import org.jclouds.profitbricks.binder.nic.UpdateNicRequestBinder;
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.http.filters.ProfitBricksSoapMessageEnvelope;
-import org.jclouds.profitbricks.http.parser.nic.NicListResponseHandler;
-import org.jclouds.profitbricks.http.parser.nic.NicResponseHandler;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Payload;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.XMLResponseParser;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PayloadParam;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.POST;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.http.parser.RequestIdOnlyResponseHandler;
-import org.jclouds.profitbricks.http.parser.nic.NicIdOnlyResponseHandler;
-
-@RequestFilters({BasicAuthentication.class, ProfitBricksSoapMessageEnvelope.class})
-@Consumes(MediaType.TEXT_XML)
-@Produces(MediaType.TEXT_XML)
-public interface NicApi {
-
- @POST
- @Named("nics:getall")
- @Payload("<ws:getAllNic/>")
- @XMLResponseParser(NicListResponseHandler.class)
- @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
- List<Nic> getAllNics();
-
- @POST
- @Named("nic:create")
- @MapBinder(CreateNicRequestBinder.class)
- @XMLResponseParser(NicIdOnlyResponseHandler.class)
- String createNic(@PayloadParam("nic") Nic.Request.CreatePayload payload);
-
- @POST
- @Named("nic:get")
- @Payload("<ws:getNic><nicId>{id}</nicId></ws:getNic>")
- @XMLResponseParser(NicResponseHandler.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- Nic getNic(@PayloadParam("id") String identifier);
-
- @POST
- @Named("nic:update")
- @MapBinder(UpdateNicRequestBinder.class)
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String updateNic(@PayloadParam("nic") Nic.Request.UpdatePayload payload);
-
- @POST
- @Named("nic:setInternetAccess")
- @MapBinder(SetInternetAccessBinder.class)
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String setInternetAccess(@PayloadParam("nic") Nic.Request.SetInternetAccessPayload payload);
-
- @POST
- @Named("nic:delete")
- @Payload("<ws:deleteNic><nicId>{id}</nicId></ws:deleteNic>")
- @Fallback(Fallbacks.FalseOnNotFoundOr404.class)
- boolean deleteNic(@PayloadParam("id") String id);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/features/ServerApi.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/features/ServerApi.java b/profitbricks/src/main/java/org/jclouds/profitbricks/features/ServerApi.java
deleted file mode 100644
index 344797d..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/features/ServerApi.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * 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 java.util.List;
-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 org.jclouds.Fallbacks;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.profitbricks.binder.server.CreateServerRequestBinder;
-import org.jclouds.profitbricks.binder.server.UpdateServerRequestBinder;
-import org.jclouds.profitbricks.domain.Server;
-import org.jclouds.profitbricks.http.filters.ProfitBricksSoapMessageEnvelope;
-import org.jclouds.profitbricks.http.parser.RequestIdOnlyResponseHandler;
-import org.jclouds.profitbricks.http.parser.server.ServerIdOnlyResponseHandler;
-import org.jclouds.profitbricks.http.parser.server.ServerInfoResponseHandler;
-import org.jclouds.profitbricks.http.parser.server.ServerListResponseHandler;
-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 ServerApi {
-
- /**
- * @return Returns information about all virtual server, such as configuration, provisioning status, power status,
- * etc.
- */
- @POST
- @Named("server:getall")
- @Payload("<ws:getAllServers/>")
- @XMLResponseParser(ServerListResponseHandler.class)
- @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
- List<Server> getAllServers();
-
- /**
- * @param identifier Identifier of the virtual server
- * @return Returns information about a virtual server, such as configuration, provisioning status, power status, etc.
- */
- @POST
- @Named("server:get")
- @Payload("<ws:getServer><serverId>{id}</serverId></ws:getServer>")
- @XMLResponseParser(ServerInfoResponseHandler.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- Server getServer(@PayloadParam("id") String identifier);
-
- /**
- * Starts an existing virtual server
- * <ul>
- * <li>Server may receive new public IP addresses if necessary </li>
- * <li>Billing will continue</li>
- * </ul>
- *
- *
- * @param id Identifier of the target virtual server
- * @return Identifier of current request
- */
- @POST
- @Named("server:start")
- @Payload("<ws:startServer><serverId>{id}</serverId></ws:startServer>")
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String startServer(@PayloadParam("id") String id);
-
- /**
- *
- * Stops an existing virtual server forcefully (HARD stop)
- * <ul>
- * <li>Server will be forcefully powered off. Any unsaved data may be lost! </li>
- * <li>Billing for this server will be stopped </li>
- * <li>When restarting the server a new public IP gets assigned, alternatively, you can reserve IP addresses, see
- * reservation of public IP blocks</li>
- * </ul>
- *
- * A graceful stop of a server is not possible through the ProfitBricks API. We recommend to access and execute the
- * command on the virtual server directly. Once the server was shutdown you still can use the "stopServer" method
- * that will stop billing.
- *
- * @param id Identifier of the target virtual server
- * @return Identifier of current request
- */
- @POST
- @Named("server:stop")
- @Payload("<ws:stopServer><serverId>{id}</serverId></ws:stopServer>")
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String stopServer(@PayloadParam("id") String id);
-
- /**
- * Resets an existing virtual server (POWER CYCLE).
- * <ul>
- * <li>Server will be forcefully powered off and restarted immediately. Any unsaved data may be lost!</li>
- * <li> Billing will continue</li>
- * </ul>
- * <b>Graceful REBOOT</b>
- *
- * A graceful reboot of a server is not possible through the ProfitBricks API. We recommend to access and execute the
- * command on the virtual server directly.
- *
- * @param id Identifier of the target virtual server
- * @return Identifier of current request
- */
- @POST
- @Named("server:reset")
- @Payload("<ws:resetServer><serverId>{id}</serverId></ws:resetServer>")
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String resetServer(@PayloadParam("id") String id);
-
- /**
- * Creates a Virtual Server within an existing data center. Parameters can be specified to set up a boot device and
- * connect the server to an existing LAN or the Internet.
- *
- * @param payload Payload
- * @return serverId of the created server
- */
- @POST
- @Named("server:create")
- @MapBinder(CreateServerRequestBinder.class)
- @XMLResponseParser(ServerIdOnlyResponseHandler.class)
- String createServer(@PayloadParam("server") Server.Request.CreatePayload payload);
-
- /**
- * Updates parameters of an existing virtual server device.
- *
- * @param payload Payload
- * @return Identifier of current request
- */
- @POST
- @Named("server:update")
- @MapBinder(UpdateServerRequestBinder.class)
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String updateServer(@PayloadParam("server") Server.Request.UpdatePayload payload);
-
- /**
- * Deletes an existing Virtual Server.
- *
- * @param id Identifier of the target virtual server
- * @return Identifier of current request
- */
- @POST
- @Named("server:delete")
- @Payload("<ws:deleteServer><serverId>{id}</serverId></ws:deleteServer>")
- @Fallback(Fallbacks.FalseOnNotFoundOr404.class)
- boolean deleteServer(@PayloadParam("id") String id);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/features/SnapshotApi.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/features/SnapshotApi.java b/profitbricks/src/main/java/org/jclouds/profitbricks/features/SnapshotApi.java
deleted file mode 100644
index 3faa386..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/features/SnapshotApi.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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 java.util.List;
-
-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 org.jclouds.Fallbacks;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.profitbricks.binder.snapshot.CreateSnapshotRequestBinder;
-import org.jclouds.profitbricks.binder.snapshot.RollbackSnapshotRequestBinder;
-import org.jclouds.profitbricks.binder.snapshot.UpdateSnapshotRequestBinder;
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.jclouds.profitbricks.http.filters.ProfitBricksSoapMessageEnvelope;
-import org.jclouds.profitbricks.http.parser.RequestIdOnlyResponseHandler;
-import org.jclouds.profitbricks.http.parser.snapshot.SnapshotResponseHandler;
-import org.jclouds.profitbricks.http.parser.snapshot.SnapshotListResponseHandler;
-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 SnapshotApi {
-
- @POST
- @Named("snapshot:getall")
- @Payload("<ws:getAllSnapshots/>")
- @XMLResponseParser(SnapshotListResponseHandler.class)
- @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
- List<Snapshot> getAllSnapshots();
-
- @POST
- @Named("snapshot:get")
- @Payload("<ws:getSnapshot><snapshotId>{snapshotId}</snapshotId></ws:getSnapshot>")
- @XMLResponseParser(SnapshotResponseHandler.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- Snapshot getSnapshot(@PayloadParam("snapshotId") String identifier);
-
- @POST
- @Named("snapshot:create")
- @MapBinder(CreateSnapshotRequestBinder.class)
- @XMLResponseParser(SnapshotResponseHandler.class)
- Snapshot createSnapshot(@PayloadParam("snapshot") Snapshot.Request.CreatePayload payload);
-
- @POST
- @Named("snapshot:update")
- @MapBinder(UpdateSnapshotRequestBinder.class)
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String updateSnapshot(@PayloadParam("snapshot") Snapshot.Request.UpdatePayload payload);
-
- @POST
- @Named("snapshot:delete")
- @Payload("<ws:deleteSnapshot><snapshotId>{id}</snapshotId></ws:deleteSnapshot>")
- @Fallback(Fallbacks.FalseOnNotFoundOr404.class)
- boolean deleteSnapshot(@PayloadParam("id") String id);
-
- @POST
- @Named("snapshot:rollback")
- @MapBinder(RollbackSnapshotRequestBinder.class)
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String rollbackSnapshot(@PayloadParam("snapshot") Snapshot.Request.RollbackPayload payload);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/features/StorageApi.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/features/StorageApi.java b/profitbricks/src/main/java/org/jclouds/profitbricks/features/StorageApi.java
deleted file mode 100644
index 0589af6..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/features/StorageApi.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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 java.util.List;
-
-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 org.jclouds.Fallbacks;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.profitbricks.binder.storage.ConnectStorageToServerRequestBinder;
-import org.jclouds.profitbricks.binder.storage.CreateStorageRequestBinder;
-import org.jclouds.profitbricks.binder.storage.UpdateStorageRequestBinder;
-import org.jclouds.profitbricks.domain.Storage;
-import org.jclouds.profitbricks.http.filters.ProfitBricksSoapMessageEnvelope;
-import org.jclouds.profitbricks.http.parser.RequestIdOnlyResponseHandler;
-import org.jclouds.profitbricks.http.parser.storage.StorageIdOnlyResponseHandler;
-import org.jclouds.profitbricks.http.parser.storage.StorageInfoResponseHandler;
-import org.jclouds.profitbricks.http.parser.storage.StorageListResponseHandler;
-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 StorageApi {
-
- /**
- *
- * @return Returns information about all virtual storage, such as configuration and provisioning state.
- */
- @POST
- @Named("storage:getall")
- @Payload("<ws:getAllStorages/>")
- @XMLResponseParser(StorageListResponseHandler.class)
- @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
- List<Storage> getAllStorages();
-
- /**
- *
- * @param id Storage identifier
- * @return Returns information about a virtual storage’s configuration and provisioning state.
- */
- @POST
- @Named("storage:get")
- @Payload("<ws:getStorage><storageId>{id}</storageId></ws:getStorage>")
- @XMLResponseParser(StorageInfoResponseHandler.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- Storage getStorage(@PayloadParam("id") String id);
-
- /**
- * Creates a virtual storage within an existing virtual data center. Additional parameters can be specified, e.g. for
- * assigning a HDD image to the storage.
- *
- * @param payload Payload
- * @return storageId of the created storage
- */
- @POST
- @Named("storage:create")
- @MapBinder(CreateStorageRequestBinder.class)
- @XMLResponseParser(StorageIdOnlyResponseHandler.class)
- String createStorage(@PayloadParam("storage") Storage.Request.CreatePayload payload);
-
- /**
- * Updates parameters of an existing virtual storage device. It is possible to increase the storage size without
- * reboot of an already provisioned storage. The additional capacity is not added to any partition. You have to
- * partition the storage afterwards. Vice versa, it is not possible to decrease the storage size of an already
- * provisioned storage.
- *
- * @param payload Payload
- * @return Identifier of current request
- */
- @POST
- @Named("storage:update")
- @MapBinder(UpdateStorageRequestBinder.class)
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String updateStorage(@PayloadParam("storage") Storage.Request.UpdatePayload payload);
-
- /**
- * Deletes an existing virtual storage device.
- *
- * @param id Identifier of the target virtual storage
- * @return Identifier of current request
- */
- @POST
- @Named("storage:delete")
- @Payload("<ws:deleteStorage><storageId>{id}</storageId></ws:deleteStorage>")
- @Fallback(Fallbacks.FalseOnNotFoundOr404.class)
- boolean deleteStorage(@PayloadParam("id") String id);
-
- /**
- * Connects a virtual storage device to an existing server.
- *
- * @param payload Payload
- * @return Identifier of current request
- */
- @POST
- @Named("storage:connect")
- @MapBinder(ConnectStorageToServerRequestBinder.class)
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String connectStorageToServer(@PayloadParam("storage") Storage.Request.ConnectPayload payload);
-
- /**
- * Disconnects a virtual storage device from a connected server.
- *
- * @param storageId Identifier of the connected virtual storage
- * @param serverId Identifier of the connected virtual server
- * @return Identifier of current request
- */
- @POST
- @Named("storage:disconnect")
- @Payload("<ws:disconnectStorageFromServer><storageId>{storageId}</storageId><serverId>{serverId}</serverId></ws:disconnectStorageFromServer>")
- @XMLResponseParser(RequestIdOnlyResponseHandler.class)
- String disconnectStorageFromServer(@PayloadParam("storageId") String storageId, @PayloadParam("serverId") String serverId);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/handlers/ProfitBricksHttpErrorHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/handlers/ProfitBricksHttpErrorHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/handlers/ProfitBricksHttpErrorHandler.java
deleted file mode 100644
index a4ecb50..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/handlers/ProfitBricksHttpErrorHandler.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.handlers;
-
-import static org.jclouds.util.Closeables2.closeQuietly;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.InsufficientResourcesException;
-import org.jclouds.rest.ResourceNotFoundException;
-
-/**
- * Parse ProfitBricks API errors and set the appropriate exception.
- *
- * @see org.jclouds.profitbricks.http.ResponseStatusFromPayloadHttpCommandExecutorService
- *
- */
-@Singleton
-public class ProfitBricksHttpErrorHandler implements HttpErrorHandler {
-
- @Override
- public void handleError(final HttpCommand command, final HttpResponse response) {
- Exception exception = null;
- try {
- switch (response.getStatusCode()) {
- case 400:
- case 405:
- exception = new IllegalArgumentException(response.getMessage(), exception);
- break;
- case 401:
- exception = new AuthorizationException("This request requires authentication.", exception);
- break;
- case 402:
- case 409:
- exception = new IllegalStateException(response.getMessage(), exception);
- break;
- case 404:
- case 410:
- if (!command.getCurrentRequest().getMethod().equals("DELETE"))
- exception = new ResourceNotFoundException(response.getMessage(), exception);
- break;
- case 413:
- case 503:
- // if nothing (default message was OK) was parsed from command executor, assume it was an 503 (Maintenance) html response.
- if (response.getMessage().equals("OK"))
- exception = new HttpResponseException("The ProfitBricks team is currently carrying out maintenance.", command, response);
- else
- exception = new InsufficientResourcesException(response.getMessage(), exception);
- break;
- }
- } finally {
- closeQuietly(response.getPayload());
- command.setException(exception);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/ResponseStatusFromPayloadHttpCommandExecutorService.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/ResponseStatusFromPayloadHttpCommandExecutorService.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/ResponseStatusFromPayloadHttpCommandExecutorService.java
deleted file mode 100644
index 00ca238..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/ResponseStatusFromPayloadHttpCommandExecutorService.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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;
-
-import static org.jclouds.util.Closeables2.closeQuietly;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.Proxy;
-import java.net.URI;
-import java.util.regex.Pattern;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.SSLContext;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpUtils;
-import org.jclouds.http.IOExceptionRetryHandler;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.http.handlers.DelegatingErrorHandler;
-import org.jclouds.http.handlers.DelegatingRetryHandler;
-import org.jclouds.http.internal.HttpWire;
-import org.jclouds.http.internal.JavaUrlHttpCommandExecutorService;
-import org.jclouds.io.ContentMetadataCodec;
-import org.jclouds.io.Payload;
-import org.jclouds.io.Payloads;
-import org.jclouds.profitbricks.domain.ServiceFault;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.io.ByteStreams;
-import com.google.inject.Inject;
-
-/**
- * Custom implementation of the HTTP driver to read actual http status and message from SOAP Fault.
- * <br/>
- * ProfitBricks API errors are always returned with 500 HTTP code. This class parses and reads the SOAP response to map
- * the actual http code and message
- */
-@Singleton
-public class ResponseStatusFromPayloadHttpCommandExecutorService extends JavaUrlHttpCommandExecutorService {
-
- private final ParseSax<ServiceFault> faultHandler;
-
- private static final Pattern endSoapTag = Pattern.compile("</.+:Envelope>$");
-
- @Inject
- ResponseStatusFromPayloadHttpCommandExecutorService(HttpUtils utils, ContentMetadataCodec contentMetadataCodec,
- DelegatingRetryHandler retryHandler, IOExceptionRetryHandler ioRetryHandler,
- DelegatingErrorHandler errorHandler, HttpWire wire, @Named("untrusted") HostnameVerifier verifier,
- @Named("untrusted") Supplier<SSLContext> untrustedSSLContextProvider, Function<URI, Proxy> proxyForURI,
- ParseSax<ServiceFault> faultHandler) {
- super(utils, contentMetadataCodec, retryHandler, ioRetryHandler, errorHandler, wire, verifier, untrustedSSLContextProvider, proxyForURI);
- this.faultHandler = faultHandler;
- }
-
- @Override
- protected HttpResponse invoke(HttpURLConnection connection) throws IOException, InterruptedException {
- HttpResponse originalResponse = super.invoke(connection);
- HttpResponse.Builder<?> responseBuilder = originalResponse.toBuilder();
-
- if (hasServerError(originalResponse) && hasPayload(originalResponse)) {
- // As we need to read the response body to determine if there are errors, but we may need to process the body
- // again later in the response parsers if everything is OK, we buffer the body into an InputStream we can reset
- InputStream in = null;
- InputStream originalInputStream = originalResponse.getPayload().openStream();
-
- if (originalInputStream instanceof ByteArrayInputStream)
- in = originalInputStream;
- else
- try {
- in = new ByteArrayInputStream(ByteStreams.toByteArray(originalInputStream));
- } finally {
- closeQuietly(originalInputStream);
- }
- try {
- if (isSoapPayload(in)) {
- ServiceFault fault = faultHandler.parse(in);
- if (fault != null)
- responseBuilder
- .statusCode(fault.httpCode())
- .message(fault.message());
- }
- } catch (Exception ex) {
- // ignore
- } finally {
- // Reset the input stream and set the payload, so it can be read again
- // by the response and error parsers
- if (in != null) {
- in.reset();
- Payload payload = Payloads.newInputStreamPayload(in);
- contentMetadataCodec.fromHeaders(payload.getContentMetadata(), originalResponse.getHeaders());
- responseBuilder.payload(payload);
- }
- }
- }
-
- return responseBuilder.build();
- }
-
- private static boolean hasServerError(final HttpResponse response) {
- return response.getStatusCode() >= 500;
- }
-
- private static boolean hasPayload(final HttpResponse response) {
- return response.getPayload() != null && response.getPayload().getRawContent() != null;
- }
-
- private static boolean isSoapPayload(final InputStream is) throws IOException {
- int size = is.available();
- char[] chars = new char[size];
- byte[] bytes = new byte[size];
-
- is.read(bytes, 0, size);
- for (int i = 0; i < size;)
- chars[i] = (char) (bytes[i++] & 0xff);
-
- is.reset(); // throws premature end of file w/o this
-
- return endSoapTag.matcher(new String(chars)).find();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/filters/ProfitBricksSoapMessageEnvelope.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/filters/ProfitBricksSoapMessageEnvelope.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/filters/ProfitBricksSoapMessageEnvelope.java
deleted file mode 100644
index af78403..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/filters/ProfitBricksSoapMessageEnvelope.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.filters;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.http.HttpException;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpRequestFilter;
-import org.jclouds.http.HttpUtils;
-import org.jclouds.io.ContentMetadata;
-import org.jclouds.io.Payload;
-import org.jclouds.io.Payloads;
-
-/**
- * Filters {@link HttpRequest} request and wraps request body into SOAP envelope.
- */
-public class ProfitBricksSoapMessageEnvelope implements HttpRequestFilter {
-
- private final String SOAP_PREFIX
- = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">"
- + "<soapenv:Header/>"
- + "<soapenv:Body>";
-
- private final String SOAP_SUFFIX = "</soapenv:Body></soapenv:Envelope>";
-
- @Override
- public HttpRequest filter(HttpRequest request) throws HttpException {
- checkNotNull(request.getPayload(), "HTTP Request must contain payload message.");
- return createSoapRequest(request);
- }
-
- private HttpRequest createSoapRequest(HttpRequest request) {
- Payload oldPayload = request.getPayload();
- ContentMetadata oldMetadata = oldPayload.getContentMetadata();
-
- String body = SOAP_PREFIX.concat(oldPayload.getRawContent().toString()).concat(SOAP_SUFFIX);
- Payload newPayload = Payloads.newStringPayload(body);
- HttpUtils.copy(oldMetadata, newPayload.getContentMetadata());
- newPayload.getContentMetadata().setContentLength(Long.valueOf(body.getBytes().length)); // resize, add prefix/suffix length
-
- return request.toBuilder().payload(newPayload).build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/BaseProfitBricksResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/BaseProfitBricksResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/BaseProfitBricksResponseHandler.java
deleted file mode 100644
index 3520b37..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/BaseProfitBricksResponseHandler.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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;
-
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.SAXException;
-
-public abstract class BaseProfitBricksResponseHandler<T> extends ParseSax.HandlerForGeneratedRequestWithResult<T> {
-
- private final StringBuilder strBuilder;
-
- public BaseProfitBricksResponseHandler() {
- this.strBuilder = new StringBuilder();
- }
-
- @Override
- public void characters(char ch[], int start, int length) {
- strBuilder.append(ch, start, length);
- }
-
- protected String textToStringValue() {
- return strBuilder.toString().trim();
- }
-
- protected Float textToFloatValue() {
- return Float.valueOf(textToStringValue());
- }
-
- protected Double textToDoubleValue() {
- return Double.valueOf(textToStringValue());
- }
-
- protected int textToIntValue() {
- return Integer.parseInt(textToStringValue());
- }
-
- protected boolean textToBooleanValue() {
- return Boolean.parseBoolean(textToStringValue());
- }
-
- protected void clearTextBuffer() {
- strBuilder.setLength(0);
- }
-
- public void reset() {
-
- }
-
- @Override
- public abstract void endElement(String uri, String localName, String qName) throws SAXException;
-
- protected abstract void setPropertyOnEndTag(String qName);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/RequestIdOnlyResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/RequestIdOnlyResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/RequestIdOnlyResponseHandler.java
deleted file mode 100644
index 2914e50..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/RequestIdOnlyResponseHandler.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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;
-
-import org.xml.sax.SAXException;
-
-public class RequestIdOnlyResponseHandler extends BaseProfitBricksResponseHandler<String> {
-
- private String requestId;
-
- RequestIdOnlyResponseHandler() {
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- setPropertyOnEndTag(qName);
- clearTextBuffer();
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("requestId".equals(qName))
- requestId = textToStringValue();
- }
-
- @Override
- public String getResult() {
- return requestId;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ServiceFaultResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ServiceFaultResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ServiceFaultResponseHandler.java
deleted file mode 100644
index f21c32e..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ServiceFaultResponseHandler.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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;
-
-import org.jclouds.profitbricks.domain.ServiceFault;
-import org.xml.sax.SAXException;
-
-public class ServiceFaultResponseHandler extends BaseProfitBricksResponseHandler<ServiceFault> {
-
- private final ServiceFault.Builder builder;
- private boolean done = false;
-
- ServiceFaultResponseHandler() {
- this.builder = ServiceFault.builder();
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("faultCode".equals(qName))
- builder.faultCode(ServiceFault.FaultCode.fromValue(textToStringValue()));
- else if ("httpCode".equals(qName))
- builder.httpCode(textToIntValue());
- else if ("message".equals(qName))
- builder.message(textToStringValue());
- else if ("requestId".equals(qName))
- builder.requestId(textToIntValue());
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- if (done)
- return;
- setPropertyOnEndTag(qName);
- if ("detail".equals(qName))
- done = true;
- clearTextBuffer();
- }
-
- @Override
- public ServiceFault getResult() {
- return builder.build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/datacenter/BaseDataCenterResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/datacenter/BaseDataCenterResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/datacenter/BaseDataCenterResponseHandler.java
deleted file mode 100644
index 931d5e9..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/datacenter/BaseDataCenterResponseHandler.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.datacenter;
-
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
-
-public abstract class BaseDataCenterResponseHandler<T> extends BaseProfitBricksResponseHandler<T> {
-
- protected DataCenter.Builder builder;
-
- BaseDataCenterResponseHandler() {
- this.builder = DataCenter.builder();
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("dataCenterId".equals(qName))
- builder.id(textToStringValue());
- else if ("dataCenterVersion".equals(qName))
- builder.version(textToIntValue());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterInfoResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterInfoResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterInfoResponseHandler.java
deleted file mode 100644
index 3e833e5..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterInfoResponseHandler.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.datacenter;
-
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.http.parser.server.ServerListResponseHandler;
-import org.jclouds.profitbricks.http.parser.storage.StorageListResponseHandler;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-import com.google.inject.Inject;
-
-public class DataCenterInfoResponseHandler extends BaseDataCenterResponseHandler<DataCenter> {
-
- private final ServerListResponseHandler serverListResponseHandler;
- private final StorageListResponseHandler storageListResponseHandler;
-
- private boolean done = false;
- private boolean useServerParser = false;
- private boolean useStorageParser = false;
-
- @Inject
- DataCenterInfoResponseHandler(ServerListResponseHandler serverListResponseHandler, StorageListResponseHandler storageListResponseHandler) {
- this.serverListResponseHandler = serverListResponseHandler;
- this.storageListResponseHandler = storageListResponseHandler;
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
- if ("servers".equals(qName))
- useServerParser = true;
- else if ("storages".equals(qName))
- useStorageParser = true;
-
- if (useServerParser)
- serverListResponseHandler.startElement(uri, localName, qName, attributes);
- else if (useStorageParser)
- storageListResponseHandler.startElement(uri, localName, qName, attributes);
- else
- super.startElement(uri, localName, qName, attributes);
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- super.setPropertyOnEndTag(qName);
- if ("dataCenterName".equals(qName))
- builder.name(textToStringValue());
- else if ("location".equals(qName))
- builder.location(Location.fromId(textToStringValue()));
- else if ("provisioningState".equals(qName))
- builder.state(ProvisioningState.fromValue(textToStringValue()));
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- if (useServerParser)
- serverListResponseHandler.characters(ch, start, length);
- else if (useStorageParser)
- storageListResponseHandler.characters(ch, start, length);
- else
- super.characters(ch, start, length);
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- if (done)
- return;
-
- if (useServerParser)
- serverListResponseHandler.endElement(uri, localName, qName);
- else if (useStorageParser)
- storageListResponseHandler.endElement(uri, localName, qName);
- else {
- setPropertyOnEndTag(qName);
- if ("return".equals(qName)) {
- done = true;
- builder.servers(serverListResponseHandler.getResult());
- builder.storages(storageListResponseHandler.getResult());
- }
- clearTextBuffer();
- }
-
- if ("servers".equals(qName))
- useServerParser = false;
- else if ("storages".equals(qName))
- useStorageParser = false;
- }
-
- @Override
- public DataCenter getResult() {
- return builder.build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterListResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterListResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterListResponseHandler.java
deleted file mode 100644
index b66264e..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/datacenter/DataCenterListResponseHandler.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.datacenter;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.xml.sax.SAXException;
-
-import com.google.common.collect.Lists;
-
-public class DataCenterListResponseHandler extends BaseDataCenterResponseHandler<List<DataCenter>> {
-
- private final List<DataCenter> dataCenters;
-
- DataCenterListResponseHandler() {
- this.dataCenters = Lists.newArrayList();
- }
-
- @Override
- public List<DataCenter> getResult() {
- return dataCenters;
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- super.setPropertyOnEndTag(qName);
- if ("dataCenterName".equals(qName))
- builder.name(textToStringValue());
- else if ("location".equals(qName))
- builder.location(Location.fromValue(textToStringValue()));
- else if ("provisioningState".equals(qName))
- builder.state(ProvisioningState.fromValue(textToStringValue()));
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- setPropertyOnEndTag(qName);
- if ("return".equals(qName)) {
- dataCenters.add(builder.build());
- builder = DataCenter.builder();
- }
- clearTextBuffer();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/BaseFirewallResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/BaseFirewallResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/BaseFirewallResponseHandler.java
deleted file mode 100644
index 310156b..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/BaseFirewallResponseHandler.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.firewall;
-
-import com.google.inject.Inject;
-
-import org.jclouds.profitbricks.domain.Firewall;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
-import org.jclouds.profitbricks.http.parser.firewall.rule.FirewallRuleListResponseHandler;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-public abstract class BaseFirewallResponseHandler<T> extends BaseProfitBricksResponseHandler<T> {
-
- protected final FirewallRuleListResponseHandler firewallRuleListResponseHandler;
-
- protected boolean useFirewallRuleParser = false;
- protected Firewall.Builder builder;
-
- @Inject
- BaseFirewallResponseHandler(FirewallRuleListResponseHandler firewallRuleListResponseHandler) {
- this.builder = Firewall.builder();
- this.firewallRuleListResponseHandler = firewallRuleListResponseHandler;
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
- if ("firewallRules".equals(qName))
- useFirewallRuleParser = true;
-
- if (useFirewallRuleParser)
- firewallRuleListResponseHandler.startElement(uri, localName, qName, attributes);
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- if (useFirewallRuleParser)
- firewallRuleListResponseHandler.characters(ch, start, length);
- else
- super.characters(ch, start, length);
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("firewallId".equals(qName))
- builder.id(textToStringValue());
- else if ("active".equals(qName))
- builder.active(textToBooleanValue());
- else if ("nicId".equals(qName))
- builder.nicId(textToStringValue());
- else if ("provisioningState".equals(qName))
- builder.state(ProvisioningState.fromValue(textToStringValue()));
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index df0d3e0..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/FirewallListResponseHandler.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.firewall;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.domain.Firewall;
-import org.jclouds.profitbricks.http.parser.firewall.rule.FirewallRuleListResponseHandler;
-import org.xml.sax.SAXException;
-
-import com.google.inject.Inject;
-import com.google.common.collect.Lists;
-
-public class FirewallListResponseHandler extends BaseFirewallResponseHandler<List<Firewall>> {
-
- private List<Firewall> firewalls;
-
- @Inject
- FirewallListResponseHandler(FirewallRuleListResponseHandler firewallRuleListResponseHandler) {
- super(firewallRuleListResponseHandler);
- this.firewalls = Lists.newArrayList();
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- if (useFirewallRuleParser)
- firewallRuleListResponseHandler.endElement(uri, localName, qName);
- else {
- setPropertyOnEndTag(qName);
- if ("return".equals(qName) || "firewall".equals(qName)) {
- firewalls.add(builder
- .rules(firewallRuleListResponseHandler.getResult())
- .build());
- firewallRuleListResponseHandler.reset();
- builder = Firewall.builder();
- }
- clearTextBuffer();
- }
-
- if ("firewallRules".equals(qName))
- useFirewallRuleParser = false;
- }
-
- @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/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/FirewallResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/FirewallResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/FirewallResponseHandler.java
deleted file mode 100644
index dae5191..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/FirewallResponseHandler.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.firewall;
-
-import com.google.inject.Inject;
-
-import org.jclouds.profitbricks.domain.Firewall;
-import org.jclouds.profitbricks.http.parser.firewall.rule.FirewallRuleListResponseHandler;
-import org.xml.sax.SAXException;
-
-public class FirewallResponseHandler extends BaseFirewallResponseHandler<Firewall> {
-
- private boolean done = false;
-
- @Inject
- FirewallResponseHandler(FirewallRuleListResponseHandler firewallRuleListResponseHandler) {
- super(firewallRuleListResponseHandler);
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- if (done)
- return;
-
- if (useFirewallRuleParser)
- firewallRuleListResponseHandler.endElement(uri, localName, qName);
- else {
- setPropertyOnEndTag(qName);
- if ("return".equals(qName)) {
- done = true;
- builder.rules(firewallRuleListResponseHandler.getResult());
- }
- clearTextBuffer();
- }
-
- if ("firewallRules".equals(qName))
- useFirewallRuleParser = false;
- }
-
- @Override
- public void reset() {
- this.builder = Firewall.builder();
- }
-
- @Override
- public Firewall getResult() {
- return builder.build();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/rule/BaseFirewallRuleResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/rule/BaseFirewallRuleResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/rule/BaseFirewallRuleResponseHandler.java
deleted file mode 100644
index 9461f46..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/rule/BaseFirewallRuleResponseHandler.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.firewall.rule;
-
-import org.jclouds.profitbricks.domain.Firewall;
-import org.jclouds.profitbricks.domain.Firewall.Protocol;
-
-import com.google.inject.Inject;
-
-import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
-
-public abstract class BaseFirewallRuleResponseHandler<T> extends BaseProfitBricksResponseHandler<T> {
-
- protected Firewall.Rule.Builder builder;
-
- @Inject
- BaseFirewallRuleResponseHandler() {
- this.builder = Firewall.Rule.builder();
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("firewallRuleId".equals(qName))
- builder.id(textToStringValue());
- else if ("name".equals(qName))
- builder.name(textToStringValue());
- else if ("portRangeEnd".equals(qName))
- builder.portRangeEnd(textToIntValue());
- else if ("portRangeStart".equals(qName))
- builder.portRangeStart(textToIntValue());
- else if ("protocol".equals(qName))
- builder.protocol(Protocol.fromValue(textToStringValue()));
- else if ("sourceIp".equals(qName))
- builder.sourceIp(textToStringValue());
- else if ("sourceMac".equals(qName))
- builder.sourceMac(textToStringValue());
- else if ("targetIp".equals(qName))
- builder.targetIp(textToStringValue());
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/rule/FirewallRuleListResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/rule/FirewallRuleListResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/rule/FirewallRuleListResponseHandler.java
deleted file mode 100644
index 3085839..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/rule/FirewallRuleListResponseHandler.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.firewall.rule;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.domain.Firewall.Rule;
-import org.xml.sax.SAXException;
-
-import com.google.common.collect.Lists;
-
-public class FirewallRuleListResponseHandler extends BaseFirewallRuleResponseHandler<List<Rule>> {
-
- private List<Rule> rules;
-
- FirewallRuleListResponseHandler() {
- this.rules = Lists.newArrayList();
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- setPropertyOnEndTag(qName);
-
- if ("firewallRules".equals(qName))
- rules.add(builder.build());
- clearTextBuffer();
-
- }
-
- @Override
- public void reset() {
- this.rules = Lists.newArrayList();
- }
-
- @Override
- public List<Rule> getResult() {
- return rules;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/image/BaseImageResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/image/BaseImageResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/image/BaseImageResponseHandler.java
deleted file mode 100644
index 1e8828c..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/image/BaseImageResponseHandler.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.image;
-
-import org.jclouds.profitbricks.domain.Image;
-import org.jclouds.profitbricks.domain.Image.Type;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
-
-public abstract class BaseImageResponseHandler<T> extends BaseProfitBricksResponseHandler<T> {
-
- protected Image.Builder builder;
-
- BaseImageResponseHandler() {
- this.builder = Image.builder();
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("imageId".equals(qName))
- builder.id(textToStringValue());
- else if ("imageName".equals(qName))
- builder.name(textToStringValue());
- else if ("imageSize".equals(qName))
- builder.size(textToFloatValue());
- else if ("imageType".equals(qName))
- builder.type(Type.fromValue(textToStringValue()));
- else if ("location".equals(qName))
- builder.location(Location.fromId(textToStringValue()));
- else if ("osType".equals(qName))
- builder.osType(OsType.fromValue(textToStringValue()));
- else if ("public".equals(qName))
- builder.isPublic(textToBooleanValue());
- else if ("writeable".equals(qName))
- builder.isWriteable(textToBooleanValue());
- else if ("bootable".equals(qName))
- builder.isBootable(textToBooleanValue());
- else if ("cpuHotPlug".equals(qName))
- builder.isCpuHotPlug(textToBooleanValue());
- else if ("cpuHotUnPlug".equals(qName))
- builder.isCpuHotUnPlug(textToBooleanValue());
- else if ("ramHotPlug".equals(qName))
- builder.isRamHotPlug(textToBooleanValue());
- else if ("ramHotUnPlug".equals(qName))
- builder.isRamHotUnPlug(textToBooleanValue());
- else if ("nicHotPlug".equals(qName))
- builder.isNicHotPlug(textToBooleanValue());
- else if ("nicHotUnPlug".equals(qName))
- builder.isNicHotUnPlug(textToBooleanValue());
- else if ("discVirtioHotPlug".equals(qName))
- builder.isDiscVirtioHotPlug(textToBooleanValue());
- else if ("discVirtioHotUnPlug".equals(qName))
- builder.isDiscVirtioHotUnPlug(textToBooleanValue());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/image/ImageInfoResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/image/ImageInfoResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/image/ImageInfoResponseHandler.java
deleted file mode 100644
index 62d3973..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/image/ImageInfoResponseHandler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.image;
-
-import org.jclouds.profitbricks.domain.Image;
-import org.xml.sax.SAXException;
-
-public class ImageInfoResponseHandler extends BaseImageResponseHandler<Image> {
-
- private boolean done = false;
-
- ImageInfoResponseHandler() {
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- if (done)
- return;
- setPropertyOnEndTag(qName);
- if ("return".equals(qName))
- done = true;
- clearTextBuffer();
- }
-
- @Override
- public Image getResult() {
- return builder.build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/image/ImageListResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/image/ImageListResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/image/ImageListResponseHandler.java
deleted file mode 100644
index ee73908..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/image/ImageListResponseHandler.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.image;
-
-import com.google.common.collect.Lists;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.domain.Image;
-import org.xml.sax.SAXException;
-
-public class ImageListResponseHandler extends BaseImageResponseHandler<List<Image>> {
-
- private final List<Image> images;
-
- ImageListResponseHandler() {
- this.images = Lists.newArrayList();
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- setPropertyOnEndTag(qName);
- if ("return".equals(qName)) {
- images.add(builder.build());
- builder = Image.builder();
- }
- clearTextBuffer();
- }
-
- @Override
- public List<Image> getResult() {
- return images;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/BaseIpBlockResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/BaseIpBlockResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/BaseIpBlockResponseHandler.java
deleted file mode 100644
index 50adfe4..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/BaseIpBlockResponseHandler.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.ipblock;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import org.jclouds.profitbricks.domain.IpBlock;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
-import org.jclouds.profitbricks.http.parser.publicip.PublicIpListResponseHandler;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-public abstract class BaseIpBlockResponseHandler<T> extends BaseProfitBricksResponseHandler<T> {
-
- protected final PublicIpListResponseHandler publicIpListResponseHandler;
- protected List<String> ips;
-
- protected IpBlock.Builder builder;
- protected boolean usePublicIpListParser = false;
-
- BaseIpBlockResponseHandler(PublicIpListResponseHandler publicIpListResponseHandler) {
- this.builder = IpBlock.builder();
- this.publicIpListResponseHandler = publicIpListResponseHandler;
- this.ips = Lists.newArrayList();
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
- if ("publicIps".equals(qName))
- usePublicIpListParser = true;
- if (usePublicIpListParser)
- publicIpListResponseHandler.startElement(uri, localName, qName, attributes);
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- if (usePublicIpListParser)
- publicIpListResponseHandler.characters(ch, start, length);
- else
- super.characters(ch, start, length);
- }
-
- @Override
- protected void setPropertyOnEndTag(String qName) {
- if ("blockId".equals(qName))
- builder.id(textToStringValue());
- else if ("location".equals(qName))
- builder.location(Location.fromId(textToStringValue()));
- else if ("ips".equals(qName))
- ips.add(textToStringValue());
- }
-}
[10/11] jclouds-labs git commit: Remove ProfitBricks
Posted by de...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/UpdateSnapshotRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/UpdateSnapshotRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/UpdateSnapshotRequestBinder.java
deleted file mode 100644
index 1414c69..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/UpdateSnapshotRequestBinder.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.snapshot;
-
-import static java.lang.String.format;
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-import org.jclouds.profitbricks.domain.Snapshot;
-
-public class UpdateSnapshotRequestBinder extends BaseProfitBricksRequestBinder<Snapshot.Request.UpdatePayload> {
-
- protected final StringBuilder requestBuilder;
-
- protected UpdateSnapshotRequestBinder() {
- super("snapshot");
- this.requestBuilder = new StringBuilder(128);
- }
-
- @Override
- protected String createPayload(Snapshot.Request.UpdatePayload payload) {
- requestBuilder.append("<ws:updateSnapshot>")
- .append("<request>")
- .append(format("<snapshotId>%s</snapshotId>", payload.id()))
- .append(format("<description>%s</description>", payload.description()))
- .append(format("<snapshotName>%s</snapshotName>", payload.name()))
- .append(formatIfNotEmpty("<bootable>%s</bootable>", payload.bootable()))
- .append(formatIfNotEmpty("<osType>%s</osType>", payload.osType()))
- .append(formatIfNotEmpty("<cpuHotPlug>%s</cpuHotPlug>", payload.isCpuHotPlug()))
- .append(formatIfNotEmpty("<cpuHotUnPlug>%s</cpuHotUnPlug>", payload.isCpuHotUnPlug()))
- .append(formatIfNotEmpty("<ramHotPlug>%s</ramHotPlug>", payload.isRamHotPlug()))
- .append(formatIfNotEmpty("<ramHotUnPlug>%s</ramHotUnPlug>", payload.isRamHotUnPlug()))
- .append(formatIfNotEmpty("<nicHotPlug>%s</nicHotPlug>", payload.isNicHotPlug()))
- .append(formatIfNotEmpty("<nicHotUnPlug>%s</nicHotUnPlug>", payload.isNicHotUnPlug()))
- .append(formatIfNotEmpty("<discVirtioHotPlug>%s</discVirtioHotPlug>", payload.isDiscVirtioHotPlug()))
- .append(formatIfNotEmpty("<discVirtioHotUnPlug>%s</discVirtioHotUnPlug>", payload.isDiscVirtioHotUnPlug()))
- .append("</request>")
- .append("</ws:updateSnapshot>");
- return requestBuilder.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/storage/ConnectStorageToServerRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/storage/ConnectStorageToServerRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/storage/ConnectStorageToServerRequestBinder.java
deleted file mode 100644
index 2c2e08d..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/storage/ConnectStorageToServerRequestBinder.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.storage;
-
-import static java.lang.String.format;
-
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-import org.jclouds.profitbricks.domain.Storage;
-
-public class ConnectStorageToServerRequestBinder extends BaseProfitBricksRequestBinder<Storage.Request.ConnectPayload> {
-
- protected final StringBuilder requestBuilder;
-
- ConnectStorageToServerRequestBinder() {
- super("storage");
- this.requestBuilder = new StringBuilder(128 * 2);
- }
-
- @Override
- protected String createPayload(Storage.Request.ConnectPayload payload) {
- requestBuilder.append("<ws:connectStorageToServer>")
- .append("<request>")
- .append(format("<storageId>%s</storageId>", payload.storageId()))
- .append(format("<serverId>%s</serverId>", payload.serverId()))
- .append(formatIfNotEmpty("<busType>%s</busType>", payload.busType()))
- .append(formatIfNotEmpty("<deviceNumber>%s</deviceNumber>", payload.deviceNumber()))
- .append("</request>")
- .append("</ws:connectStorageToServer>");
- return requestBuilder.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/storage/CreateStorageRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/storage/CreateStorageRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/storage/CreateStorageRequestBinder.java
deleted file mode 100644
index 9681b64..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/storage/CreateStorageRequestBinder.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.storage;
-
-import static java.lang.String.format;
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-import org.jclouds.profitbricks.domain.Storage;
-
-public class CreateStorageRequestBinder extends BaseProfitBricksRequestBinder<Storage.Request.CreatePayload> {
-
- protected final StringBuilder requestBuilder;
-
- CreateStorageRequestBinder() {
- super("storage");
- this.requestBuilder = new StringBuilder(128 * 2);
- }
-
- @Override
- protected String createPayload(Storage.Request.CreatePayload payload) {
- requestBuilder.append("<ws:createStorage>")
- .append("<request>")
- .append(format("<dataCenterId>%s</dataCenterId>", payload.dataCenterId()))
- .append(formatIfNotEmpty("<storageName>%s</storageName>", payload.name()))
- .append(format("<size>%.0f</size>", payload.size()))
- .append(formatIfNotEmpty("<mountImageId>%s</mountImageId>", payload.mountImageId()))
- .append(formatIfNotEmpty("<profitBricksImagePassword>%s</profitBricksImagePassword>", payload.imagePassword()))
- .append("</request>")
- .append("</ws:createStorage>");
- return requestBuilder.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/storage/UpdateStorageRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/storage/UpdateStorageRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/storage/UpdateStorageRequestBinder.java
deleted file mode 100644
index 9a80b83..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/storage/UpdateStorageRequestBinder.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.storage;
-
-import static java.lang.String.format;
-import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
-import org.jclouds.profitbricks.domain.Storage;
-
-public class UpdateStorageRequestBinder extends BaseProfitBricksRequestBinder<Storage.Request.UpdatePayload> {
-
- protected final StringBuilder requestBuilder;
-
- UpdateStorageRequestBinder() {
- super("storage");
- this.requestBuilder = new StringBuilder(128 * 2);
- }
-
- @Override
- protected String createPayload(Storage.Request.UpdatePayload payload) {
- requestBuilder
- .append("<ws:updateStorage>")
- .append("<request>")
- .append(format("<storageId>%s</storageId>", payload.id()))
- .append(formatIfNotEmpty("<size>%.0f</size>", payload.size()))
- .append(formatIfNotEmpty("<storageName>%s</storageName>", payload.name()))
- .append(formatIfNotEmpty("<mountImageId>%s</mountImageId>", payload.mountImageId()))
- .append("</request>")
- .append("</ws:updateStorage>");
-
- return requestBuilder.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/compute/ProfitBricksComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/ProfitBricksComputeServiceAdapter.java b/profitbricks/src/main/java/org/jclouds/profitbricks/compute/ProfitBricksComputeServiceAdapter.java
deleted file mode 100644
index fe02c41..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/ProfitBricksComputeServiceAdapter.java
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
- * 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.compute;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Strings.isNullOrEmpty;
-import static com.google.common.collect.Iterables.transform;
-import static com.google.common.util.concurrent.Futures.allAsList;
-import static com.google.common.util.concurrent.Futures.getUnchecked;
-import static java.lang.String.format;
-import static org.jclouds.Constants.PROPERTY_USER_THREADS;
-import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.POLL_PREDICATE_DATACENTER;
-
-import java.util.List;
-import java.util.concurrent.Callable;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.HardwareBuilder;
-import org.jclouds.compute.domain.Processor;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.domain.Volume;
-import org.jclouds.compute.domain.internal.VolumeImpl;
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.compute.util.ComputeServiceUtils;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.logging.Logger;
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.compute.concurrent.ProvisioningJob;
-import org.jclouds.profitbricks.compute.concurrent.ProvisioningManager;
-import org.jclouds.profitbricks.compute.function.ProvisionableToImage;
-import org.jclouds.profitbricks.compute.strategy.TemplateWithDataCenter;
-import org.jclouds.profitbricks.domain.AvailabilityZone;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Image;
-import org.jclouds.profitbricks.domain.Provisionable;
-import org.jclouds.profitbricks.domain.Server;
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.jclouds.profitbricks.domain.Storage;
-import org.jclouds.profitbricks.features.ServerApi;
-import org.jclouds.profitbricks.util.Passwords;
-import org.jclouds.rest.ResourceNotFoundException;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.inject.Inject;
-
-@Singleton
-public class ProfitBricksComputeServiceAdapter implements ComputeServiceAdapter<Server, Hardware, Provisionable, Location> {
-
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- private final ProfitBricksApi api;
- private final Predicate<String> waitDcUntilAvailable;
- private final ListeningExecutorService executorService;
- private final ProvisioningJob.Factory jobFactory;
- private final ProvisioningManager provisioningManager;
-
- private static final Integer DEFAULT_LAN_ID = 1;
-
- @Inject
- ProfitBricksComputeServiceAdapter(ProfitBricksApi api,
- @Named(POLL_PREDICATE_DATACENTER) Predicate<String> waitDcUntilAvailable,
- @Named(PROPERTY_USER_THREADS) ListeningExecutorService executorService,
- ProvisioningJob.Factory jobFactory,
- ProvisioningManager provisioningManager) {
- this.api = api;
- this.waitDcUntilAvailable = waitDcUntilAvailable;
- this.executorService = executorService;
- this.jobFactory = jobFactory;
- this.provisioningManager = provisioningManager;
- }
-
- @Override
- public NodeAndInitialCredentials<Server> createNodeWithGroupEncodedIntoName(String group, String name, Template template) {
- checkArgument(template instanceof TemplateWithDataCenter, "This implementation requires a TemplateWithDataCenter");
- return createNodeWithGroupEncodedIntoName(group, name, TemplateWithDataCenter.class.cast(template));
- }
-
- protected NodeAndInitialCredentials<Server> createNodeWithGroupEncodedIntoName(String group, String name, TemplateWithDataCenter template) {
- checkArgument(template.getLocation().getScope() == LocationScope.ZONE, "Template must use a ZONE-scoped location");
- final String dataCenterId = template.getDataCenter().id();
-
- Hardware hardware = template.getHardware();
-
- TemplateOptions options = template.getOptions();
- final String loginUser = isNullOrEmpty(options.getLoginUser()) ? "root" : options.getLoginUser();
- final String password = options.hasLoginPassword() ? options.getLoginPassword() : Passwords.generate();
-
- final org.jclouds.compute.domain.Image image = template.getImage();
-
- // provision all storages based on hardware
- List<? extends Volume> volumes = hardware.getVolumes();
- List<String> storageIds = Lists.newArrayListWithExpectedSize(volumes.size());
-
- int i = 1;
- for (final Volume volume : volumes)
- try {
- logger.trace("<< provisioning storage '%s'", volume);
- final Storage.Request.CreatePayload.Builder storageBuilder = Storage.Request.creatingBuilder();
- if (i == 1) {
- storageBuilder.mountImageId(image.getId());
- // we don't need to pass password to the API if we're using a snapshot
- Provisionable.Type provisionableType = Provisionable.Type.fromValue(
- image.getUserMetadata().get(ProvisionableToImage.KEY_PROVISIONABLE_TYPE));
- if (provisionableType == Provisionable.Type.IMAGE)
- storageBuilder.imagePassword(password);
- }
- storageBuilder.dataCenterId(dataCenterId)
- .name(format("%s-disk-%d", name, i++))
- .size(volume.getSize());
-
- String storageId = (String) provisioningManager.provision(jobFactory.create(dataCenterId, new Supplier<Object>() {
-
- @Override
- public Object get() {
- return api.storageApi().createStorage(storageBuilder.build());
- }
- }));
-
- storageIds.add(storageId);
- logger.trace(">> provisioning complete for storage. returned id='%s'", storageId);
- } catch (Exception ex) {
- if (i - 1 == 1) // if first storage (one with image) provisioning fails; stop method
- throw Throwables.propagate(ex);
- logger.warn(ex, ">> failed to provision storage. skipping..");
- }
-
- int lanId = DEFAULT_LAN_ID;
- if (options.getNetworks() != null)
- try {
- String networkId = Iterables.get(options.getNetworks(), 0);
- lanId = Integer.valueOf(networkId);
- } catch (Exception ex) {
- logger.warn("no valid network id found from options. using default id='%d'", DEFAULT_LAN_ID);
- }
-
- Double cores = ComputeServiceUtils.getCores(hardware);
-
- // provision server and connect boot storage (first provisioned)
- String serverId = null;
- try {
- String storageBootDeviceId = Iterables.get(storageIds, 0); // must have atleast 1
- final Server.Request.CreatePayload serverRequest = Server.Request.creatingBuilder()
- .dataCenterId(dataCenterId)
- .name(name)
- .bootFromStorageId(storageBootDeviceId)
- .cores(cores.intValue())
- .ram(hardware.getRam())
- .availabilityZone(AvailabilityZone.AUTO)
- .hasInternetAccess(true)
- .lanId(lanId)
- .build();
- logger.trace("<< provisioning server '%s'", serverRequest);
-
- serverId = (String) provisioningManager.provision(jobFactory.create(dataCenterId, new Supplier<Object>() {
-
- @Override
- public Object get() {
- return api.serverApi().createServer(serverRequest);
- }
- }));
- logger.trace(">> provisioning complete for server. returned id='%s'", serverId);
-
- } catch (Exception ex) {
- logger.error(ex, ">> failed to provision server. rollbacking..");
- destroyStorages(storageIds, dataCenterId);
- throw Throwables.propagate(ex);
- }
-
- // connect the rest of storages to server; delete if fails
- final int storageCount = storageIds.size();
- for (int j = 1; j < storageCount; j++) { // skip first; already connected
- String storageId = storageIds.get(j);
- try {
- logger.trace("<< connecting storage '%s' to server '%s'", storageId, serverId);
- final Storage.Request.ConnectPayload request = Storage.Request.connectingBuilder()
- .storageId(storageId)
- .serverId(serverId)
- .build();
-
- provisioningManager.provision(jobFactory.create(group, new Supplier<Object>() {
-
- @Override
- public Object get() {
- return api.storageApi().connectStorageToServer(request);
- }
- }));
-
- logger.trace(">> storage connected.");
- } catch (Exception ex) {
- // delete unconnected storage
- logger.warn(ex, ">> failed to connect storage '%s'. deleting..", storageId);
- destroyStorage(storageId, dataCenterId);
- }
- }
-
- // Last paranoid check
- waitDcUntilAvailable.apply(dataCenterId);
-
- LoginCredentials serverCredentials = LoginCredentials.builder()
- .user(loginUser)
- .password(password)
- .build();
-
- Server server = getNode(serverId);
-
- return new NodeAndInitialCredentials<Server>(server, serverId, serverCredentials);
- }
-
- @Override
- public Iterable<Hardware> listHardwareProfiles() {
- // Max [cores=48] [disk size per storage=2048GB] [ram=200704 MB]
- List<Hardware> hardwares = Lists.newArrayList();
- for (int core = 1; core <= 48; core++)
- for (int ram : new int[]{1024, 2 * 1024, 4 * 1024, 8 * 1024,
- 10 * 1024, 16 * 1024, 24 * 1024, 28 * 1024, 32 * 1024})
- for (float size : new float[]{10, 20, 30, 50, 80, 100, 150, 200, 250, 500}) {
- String id = String.format("cpu=%d,ram=%s,disk=%f", core, ram, size);
- hardwares.add(new HardwareBuilder()
- .ids(id)
- .ram(ram)
- .hypervisor("kvm")
- .name(id)
- .processor(new Processor(core, 1d))
- .volume(new VolumeImpl(size, true, true))
- .build());
- }
- return hardwares;
- }
-
- @Override
- public Iterable<Provisionable> listImages() {
- // fetch images..
- ListenableFuture<List<Image>> images = executorService.submit(new Callable<List<Image>>() {
-
- @Override
- public List<Image> call() throws Exception {
- logger.trace("<< fetching images..");
- // Filter HDD types only, since JClouds doesn't have a concept of "CD-ROM" anyway
- Iterable<Image> filteredImages = Iterables.filter(api.imageApi().getAllImages(), new Predicate<Image>() {
-
- @Override
- public boolean apply(Image image) {
- return image.type() == Image.Type.HDD;
- }
- });
- logger.trace(">> images fetched.");
-
- return ImmutableList.copyOf(filteredImages);
- }
-
- });
- // and snapshots at the same time
- ListenableFuture<List<Snapshot>> snapshots = executorService.submit(new Callable<List<Snapshot>>() {
-
- @Override
- public List<Snapshot> call() throws Exception {
- logger.trace("<< fetching snapshots");
- List<Snapshot> remoteSnapshots = api.snapshotApi().getAllSnapshots();
- logger.trace(">> snapshots feched.");
-
- return remoteSnapshots;
- }
-
- });
-
- return Iterables.concat(getUnchecked(images), getUnchecked(snapshots));
- }
-
- @Override
- public Provisionable getImage(String id) {
- // try search images
- logger.trace("<< searching for image with id=%s", id);
- Image image = api.imageApi().getImage(id);
- if (image != null) {
- logger.trace(">> found image [%s].", image.name());
- return image;
- }
- // try search snapshots
- logger.trace("<< not found from images. searching for snapshot with id=%s", id);
- Snapshot snapshot = api.snapshotApi().getSnapshot(id);
- if (snapshot != null) {
- logger.trace(">> found snapshot [%s]", snapshot.name());
- return snapshot;
- }
- throw new ResourceNotFoundException("No image/snapshot with id '" + id + "' was found");
- }
-
- @Override
- public Iterable<Location> listLocations() {
- // Will never be called
- throw new UnsupportedOperationException("Locations are configured in jclouds properties");
- }
-
- @Override
- public Server getNode(String id) {
- logger.trace("<< searching for server with id=%s", id);
-
- Server server = api.serverApi().getServer(id);
- if (server != null)
- logger.trace(">> found server [%s]", server.name());
- return server;
- }
-
- @Override
- public void destroyNode(String nodeId) {
- ServerApi serverApi = api.serverApi();
- Server server = serverApi.getServer(nodeId);
- if (server != null) {
- String dataCenterId = server.dataCenter().id();
- for (Storage storage : server.storages())
- destroyStorage(storage.id(), dataCenterId);
-
- try {
- destroyServer(nodeId, dataCenterId);
- } catch (Exception ex) {
- logger.warn(ex, ">> failed to delete server with id=%s", nodeId);
- }
- }
- }
-
- @Override
- public void rebootNode(final String id) {
- // Fail pre-emptively if not found
- final Server node = getRequiredNode(id);
- final DataCenter dataCenter = node.dataCenter();
- provisioningManager.provision(jobFactory.create(dataCenter.id(), new Supplier<Object>() {
-
- @Override
- public Object get() {
- api.serverApi().resetServer(id);
-
- return node;
- }
- }));
- }
-
- @Override
- public void resumeNode(final String id) {
- final Server node = getRequiredNode(id);
- if (node.status() == Server.Status.RUNNING)
- return;
-
- final DataCenter dataCenter = node.dataCenter();
- provisioningManager.provision(jobFactory.create(dataCenter.id(), new Supplier<Object>() {
-
- @Override
- public Object get() {
- api.serverApi().startServer(id);
-
- return node;
- }
- }));
- }
-
- @Override
- public void suspendNode(final String id) {
- final Server node = getRequiredNode(id);
- // Intentionally didn't include SHUTDOWN (only achieved via UI; soft-shutdown).
- // A SHUTOFF server is no longer billed, so we execute method for all other status
- if (node.status() == Server.Status.SHUTOFF)
- return;
-
- final DataCenter dataCenter = node.dataCenter();
- provisioningManager.provision(jobFactory.create(dataCenter.id(), new Supplier<Object>() {
-
- @Override
- public Object get() {
- api.serverApi().stopServer(id);
-
- return node;
- }
- }));
- }
-
- @Override
- public Iterable<Server> listNodes() {
- logger.trace(">> fetching all servers..");
- List<Server> servers = api.serverApi().getAllServers();
- logger.trace(">> servers fetched.");
- return servers;
- }
-
- @Override
- public Iterable<Server> listNodesByIds(final Iterable<String> ids) {
- // Only fetch the requested nodes. Do it in parallel.
- ListenableFuture<List<Server>> futures = allAsList(transform(ids,
- new Function<String, ListenableFuture<Server>>() {
-
- @Override
- public ListenableFuture<Server> apply(final String input) {
- return executorService.submit(new Callable<Server>() {
-
- @Override
- public Server call() throws Exception {
- return getNode(input);
- }
- });
- }
- }));
-
- return getUnchecked(futures);
- }
-
- private void destroyServer(final String serverId, final String dataCenterId) {
- try {
- logger.trace("<< deleting server with id=%s", serverId);
- provisioningManager.provision(jobFactory.create(dataCenterId, new Supplier<Object>() {
-
- @Override
- public Object get() {
- api.serverApi().deleteServer(serverId);
-
- return serverId;
- }
- }));
- logger.trace(">> server '%s' deleted.", serverId);
- } catch (Exception ex) {
- logger.warn(ex, ">> failed to delete server with id=%s", serverId);
- }
- }
-
- private void destroyStorages(List<String> storageIds, String dataCenterId) {
- for (String storageId : storageIds)
- destroyStorage(storageId, dataCenterId);
- }
-
- private void destroyStorage(final String storageId, final String dataCenterId) {
- try {
- logger.trace("<< deleting storage with id=%s", storageId);
- provisioningManager.provision(jobFactory.create(dataCenterId, new Supplier<Object>() {
-
- @Override
- public Object get() {
- api.storageApi().deleteStorage(storageId);
-
- return storageId;
- }
- }));
- logger.trace(">> storage '%s' deleted.", storageId);
- } catch (Exception ex) {
- logger.warn(ex, ">> failed to delete storage with id=%s", storageId);
- }
- }
-
- private Server getRequiredNode(String nodeId) {
- Server node = getNode(nodeId);
- if (node == null)
- throw new ResourceNotFoundException("Node with id'" + nodeId + "' was not found.");
- return node;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/compute/concurrent/ProvisioningJob.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/concurrent/ProvisioningJob.java b/profitbricks/src/main/java/org/jclouds/profitbricks/compute/concurrent/ProvisioningJob.java
deleted file mode 100644
index 7da7d3c..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/concurrent/ProvisioningJob.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.compute.concurrent;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.POLL_PREDICATE_DATACENTER;
-
-import java.util.concurrent.Callable;
-
-import javax.inject.Named;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.inject.Inject;
-import com.google.inject.assistedinject.Assisted;
-
-public class ProvisioningJob implements Callable {
-
- public interface Factory {
-
- ProvisioningJob create(String group, Supplier<Object> operation);
- }
-
- private final Predicate<String> waitDataCenterUntilReady;
- private final String group;
- private final Supplier<Object> operation;
-
- @Inject
- ProvisioningJob(@Named(POLL_PREDICATE_DATACENTER) Predicate<String> waitDataCenterUntilReady,
- @Assisted String group, @Assisted Supplier<Object> operation) {
- this.waitDataCenterUntilReady = waitDataCenterUntilReady;
- this.group = checkNotNull(group, "group cannot be null");
- this.operation = checkNotNull(operation, "operation cannot be null");
- }
-
- @Override
- public Object call() throws Exception {
- waitDataCenterUntilReady.apply(group);
- Object obj = operation.get();
- waitDataCenterUntilReady.apply(group);
-
- return obj;
- }
-
- public String getGroup() {
- return group;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/compute/concurrent/ProvisioningManager.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/concurrent/ProvisioningManager.java b/profitbricks/src/main/java/org/jclouds/profitbricks/compute/concurrent/ProvisioningManager.java
deleted file mode 100644
index 820cafe..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/concurrent/ProvisioningManager.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.compute.concurrent;
-
-import static com.google.common.util.concurrent.Futures.getUnchecked;
-import static com.google.common.util.concurrent.MoreExecutors.listeningDecorator;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.annotation.Resource;
-
-import org.jclouds.concurrent.config.WithSubmissionTrace;
-import org.jclouds.logging.Logger;
-
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- * Delegates {@link Job} to single-threaded executor services based on it's group.
- *
- */
-public final class ProvisioningManager implements Closeable {
-
- @Resource
- private Logger logger = Logger.NULL;
-
- private final Map<String, ListeningExecutorService> workers
- = new ConcurrentHashMap<String, ListeningExecutorService>(1);
-
- private final AtomicBoolean terminated = new AtomicBoolean(false);
-
- public Object provision(ProvisioningJob job) {
- if (terminated.get()) {
- logger.warn("Job(%s) submitted but the provisioning manager is already closed", job);
- return null;
- }
-
- logger.debug("Job(%s) submitted to group '%s'", job, job.getGroup());
- ListeningExecutorService workerGroup = getWorkerGroup(job.getGroup());
- return getUnchecked(workerGroup.submit(job));
- }
-
- protected ListeningExecutorService newExecutorService() {
- return WithSubmissionTrace.wrap(listeningDecorator(Executors.newSingleThreadExecutor()));
- }
-
- private void newWorkerGroupIfAbsent(String name) {
- if (!workers.containsKey(name))
- workers.put(name, newExecutorService());
- }
-
- private ListeningExecutorService getWorkerGroup(String name) {
- newWorkerGroupIfAbsent(name);
- return workers.get(name);
- }
-
- @Override
- public void close() throws IOException {
- terminated.set(true); // Do not allow to enqueue more jobs
- Collection<ListeningExecutorService> executors = workers.values();
- for (ListeningExecutorService executor : executors) {
- List<Runnable> runnables = executor.shutdownNow();
- if (!runnables.isEmpty())
- logger.warn("when shutting down executor %s, runnables outstanding: %s", executor, runnables);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/compute/config/ProfitBricksComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/config/ProfitBricksComputeServiceContextModule.java b/profitbricks/src/main/java/org/jclouds/profitbricks/compute/config/ProfitBricksComputeServiceContextModule.java
deleted file mode 100644
index abc732d..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/config/ProfitBricksComputeServiceContextModule.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * 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.compute.config;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_SUSPENDED;
-import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.POLL_INITIAL_PERIOD;
-import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.POLL_MAX_PERIOD;
-import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.POLL_PREDICATE_DATACENTER;
-import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.POLL_PREDICATE_SNAPSHOT;
-import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.TIMEOUT_DATACENTER_AVAILABLE;
-import static org.jclouds.util.Predicates2.retry;
-
-import java.util.concurrent.TimeUnit;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.Volume;
-import org.jclouds.compute.strategy.CreateNodesInGroupThenAddToSet;
-import org.jclouds.domain.Location;
-import org.jclouds.functions.IdentityFunction;
-import org.jclouds.lifecycle.Closer;
-import org.jclouds.location.suppliers.ImplicitLocationSupplier;
-import org.jclouds.location.suppliers.implicit.OnlyLocationOrFirstZone;
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.compute.ProfitBricksComputeServiceAdapter;
-import org.jclouds.profitbricks.compute.concurrent.ProvisioningJob;
-import org.jclouds.profitbricks.compute.concurrent.ProvisioningManager;
-import org.jclouds.profitbricks.compute.function.ProvisionableToImage;
-import org.jclouds.profitbricks.compute.function.ServerToNodeMetadata;
-import org.jclouds.profitbricks.compute.function.StorageToVolume;
-import org.jclouds.profitbricks.compute.strategy.AssignDataCenterToTemplate;
-import org.jclouds.profitbricks.domain.Provisionable;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.domain.Server;
-import org.jclouds.profitbricks.domain.Storage;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.inject.Inject;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-import com.google.inject.TypeLiteral;
-import com.google.inject.assistedinject.FactoryModuleBuilder;
-
-
-public class ProfitBricksComputeServiceContextModule extends
- ComputeServiceAdapterContextModule<Server, Hardware, Provisionable, Location> {
-
- @SuppressWarnings("unchecked")
- @Override
- protected void configure() {
- super.configure();
-
- install(new FactoryModuleBuilder().build(ProvisioningJob.Factory.class));
-
- bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Scopes.SINGLETON);
-
- bind(CreateNodesInGroupThenAddToSet.class).to(AssignDataCenterToTemplate.class).in(Scopes.SINGLETON);
-
- bind(new TypeLiteral<ComputeServiceAdapter<Server, Hardware, Provisionable, Location>>() {
- }).to(ProfitBricksComputeServiceAdapter.class);
-
- bind(new TypeLiteral<Function<Server, NodeMetadata>>() {
- }).to(ServerToNodeMetadata.class);
-
- bind(new TypeLiteral<Function<Provisionable, Image>>() {
- }).to(ProvisionableToImage.class);
-
- bind(new TypeLiteral<Function<Storage, Volume>>() {
- }).to(StorageToVolume.class);
-
- bind(new TypeLiteral<Function<Hardware, Hardware>>() {
- }).to(Class.class.cast(IdentityFunction.class));
- }
-
- @Provides
- @Singleton
- @Named(POLL_PREDICATE_DATACENTER)
- Predicate<String> provideDataCenterAvailablePredicate(
- final ProfitBricksApi api, ComputeConstants constants) {
- return retry(new DataCenterProvisioningStatePredicate(
- api, ProvisioningState.AVAILABLE),
- constants.pollTimeout(), constants.pollPeriod(), constants.pollMaxPeriod(), TimeUnit.SECONDS);
- }
-
- @Provides
- @Named(TIMEOUT_NODE_RUNNING)
- Predicate<String> provideServerRunningPredicate(final ProfitBricksApi api, ComputeConstants constants) {
- return retry(new ServerStatusPredicate(
- api, Server.Status.RUNNING),
- constants.pollTimeout(), constants.pollPeriod(), constants.pollMaxPeriod(), TimeUnit.SECONDS);
- }
-
- @Provides
- @Named(TIMEOUT_NODE_SUSPENDED)
- Predicate<String> provideServerSuspendedPredicate(final ProfitBricksApi api, ComputeConstants constants) {
- return retry(new ServerStatusPredicate(
- api, Server.Status.SHUTOFF),
- constants.pollTimeout(), constants.pollPeriod(), constants.pollMaxPeriod(), TimeUnit.SECONDS);
- }
-
- @Provides
- @Singleton
- ProvisioningManager provideProvisioningManager(Closer closer) {
- ProvisioningManager provisioningManager = new ProvisioningManager();
- closer.addToClose(provisioningManager);
-
- return provisioningManager;
- }
-
- @Provides
- @Singleton
- @Named(POLL_PREDICATE_SNAPSHOT)
- Predicate<String> provideSnapshotAvailablePredicate(final ProfitBricksApi api, ComputeConstants constants) {
- return retry(new SnapshotProvisioningStatePredicate(
- api, ProvisioningState.AVAILABLE),
- constants.pollTimeout(), constants.pollPeriod(), constants.pollMaxPeriod(), TimeUnit.SECONDS);
- }
-
- static class DataCenterProvisioningStatePredicate implements Predicate<String> {
-
- private final ProfitBricksApi api;
- private final ProvisioningState expectedState;
-
- public DataCenterProvisioningStatePredicate(ProfitBricksApi api, ProvisioningState expectedState) {
- this.api = checkNotNull(api, "api must not be null");
- this.expectedState = checkNotNull(expectedState, "expectedState must not be null");
- }
-
- @Override
- public boolean apply(String input) {
- checkNotNull(input, "datacenter id");
- return api.dataCenterApi().getDataCenterState(input) == expectedState;
- }
-
- }
-
- static class ServerStatusPredicate implements Predicate<String> {
-
- private final ProfitBricksApi api;
- private final Server.Status expectedStatus;
-
- public ServerStatusPredicate(ProfitBricksApi api, Server.Status expectedStatus) {
- this.api = checkNotNull(api, "api must not be null");
- this.expectedStatus = checkNotNull(expectedStatus, "expectedStatus must not be null");
- }
-
- @Override
- public boolean apply(String input) {
- checkNotNull(input, "server id");
- return api.serverApi().getServer(input).status() == expectedStatus;
- }
-
- }
-
- static class SnapshotProvisioningStatePredicate implements Predicate<String> {
-
- private final ProfitBricksApi api;
- private final ProvisioningState expectedState;
-
- public SnapshotProvisioningStatePredicate(ProfitBricksApi api, ProvisioningState expectedState) {
- this.api = checkNotNull(api, "api must not be null");
- this.expectedState = checkNotNull(expectedState, "expectedState must not be null");
- }
-
- @Override
- public boolean apply(String input) {
- checkNotNull(input, "snapshot id");
- return api.snapshotApi().getSnapshot(input).state() == expectedState;
- }
-
- }
-
- @Singleton
- public static class ComputeConstants {
-
- @Inject
- @Named(TIMEOUT_DATACENTER_AVAILABLE)
- private String pollTimeout;
-
- @Inject
- @Named(POLL_INITIAL_PERIOD)
- private String pollPeriod;
-
- @Inject
- @Named(POLL_MAX_PERIOD)
- private String pollMaxPeriod;
-
- public long pollTimeout() {
- return Long.parseLong(pollTimeout);
- }
-
- public long pollPeriod() {
- return Long.parseLong(pollPeriod);
- }
-
- public long pollMaxPeriod() {
- return Long.parseLong(pollMaxPeriod);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/ProvisionableToImage.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/ProvisionableToImage.java b/profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/ProvisionableToImage.java
deleted file mode 100644
index 5b27370..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/ProvisionableToImage.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * 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.compute.function;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.find;
-import static org.jclouds.location.predicates.LocationPredicates.idEquals;
-
-import java.util.Set;
-import java.util.regex.Pattern;
-
-import org.jclouds.collect.Memoized;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.ImageBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.domain.Location;
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.jclouds.profitbricks.domain.Provisionable;
-
-import com.google.common.base.Function;
-import com.google.common.base.Strings;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableMap;
-import com.google.inject.Inject;
-
-public class ProvisionableToImage implements Function<Provisionable, Image> {
-
- public static final String KEY_PROVISIONABLE_TYPE = "provisionableType";
-
- private final ImageToImage fnImageToImage;
- private final SnapshotToImage fnSnapshotToImage;
-
- @Inject
- ProvisionableToImage(@Memoized Supplier<Set<? extends Location>> locations) {
- this.fnImageToImage = new ImageToImage(locations);
- this.fnSnapshotToImage = new SnapshotToImage(locations);
- }
-
- @Override
- public Image apply(Provisionable input) {
- checkNotNull(input, "Cannot convert null input");
-
- if (input instanceof org.jclouds.profitbricks.domain.Image)
- return fnImageToImage.apply((org.jclouds.profitbricks.domain.Image) input);
-
- else if (input instanceof Snapshot)
- return fnSnapshotToImage.apply((Snapshot) input);
-
- else
- throw new UnsupportedOperationException("No implementation found for provisionable of concrete type '"
- + input.getClass().getCanonicalName() + "'");
- }
-
- private static OsFamily mapOsFamily(OsType osType) {
- if (osType == null)
- return OsFamily.UNRECOGNIZED;
- switch (osType) {
- case WINDOWS:
- return OsFamily.WINDOWS;
- case LINUX:
- return OsFamily.LINUX;
- case UNRECOGNIZED:
- case OTHER:
- default:
- return OsFamily.UNRECOGNIZED;
- }
- }
-
- private static class ImageToImage implements ImageFunction<org.jclouds.profitbricks.domain.Image> {
-
- private static final Pattern HAS_NUMBERS = Pattern.compile(".*\\d+.*");
-
- private final Supplier<Set<? extends Location>> locations;
-
- ImageToImage(Supplier<Set<? extends Location>> locations) {
- this.locations = locations;
- }
-
- @Override
- public Image apply(org.jclouds.profitbricks.domain.Image from) {
- String desc = from.name();
- OsFamily osFamily = parseOsFamily(desc, from.osType());
- Location location = find(locations.get(), idEquals(from.location().getId()));
-
- OperatingSystem os = OperatingSystem.builder()
- .description(osFamily.value())
- .family(osFamily)
- .version(parseVersion(desc))
- .is64Bit(is64Bit(desc, from.type()))
- .build();
-
- return addTypeMetadata(new ImageBuilder()
- .ids(from.id())
- .name(desc)
- .location(location)
- .status(Image.Status.AVAILABLE)
- .operatingSystem(os))
- .build();
- }
-
- private OsFamily parseOsFamily(String from, OsType fallbackValue) {
- if (from != null)
- try {
- // ProfitBricks images names are usually in format:
- // [osType]-[version]-[subversion]-..-[date-created]
- String desc = from.toUpperCase().split("-")[0];
- OsFamily osFamily = OsFamily.fromValue(desc);
- checkArgument(osFamily != OsFamily.UNRECOGNIZED);
-
- return osFamily;
- } catch (Exception ex) {
- // do nothing
- }
- return mapOsFamily(fallbackValue);
- }
-
- private String parseVersion(String from) {
- if (from != null) {
- String[] split = from.toLowerCase().split("-");
- if (split.length >= 2) {
- int i = 1; // usually on second token
- String version = split[i];
- while (!HAS_NUMBERS.matcher(version).matches())
- version = split[++i];
- return version;
- }
- }
- return "";
- }
-
- private boolean is64Bit(String from, org.jclouds.profitbricks.domain.Image.Type type) {
- switch (type) {
- case CDROM:
- if (!Strings.isNullOrEmpty(from))
- return from.matches("x86_64|amd64");
- case HDD: // HDD provided by ProfitBricks are always 64-bit
- default:
- return true;
- }
- }
-
- @Override
- public ImageBuilder addTypeMetadata(ImageBuilder builder) {
- return builder.userMetadata(ImmutableMap.of(KEY_PROVISIONABLE_TYPE, Provisionable.Type.IMAGE.toString()));
- }
- }
-
- private static class SnapshotToImage implements ImageFunction<Snapshot> {
-
- private final Supplier<Set<? extends Location>> locations;
-
- SnapshotToImage(Supplier<Set<? extends Location>> locations) {
- this.locations = locations;
- }
-
- @Override
- public Image apply(Snapshot from) {
- String textToParse = from.name() + from.description();
- OsFamily osFamily = parseOsFamily(textToParse, from.osType());
- Location location = find(locations.get(), idEquals(from.location().getId()));
-
- OperatingSystem os = OperatingSystem.builder()
- .description(osFamily.value())
- .family(osFamily)
- .is64Bit(true)
- .version("00.00")
- .build();
-
- return addTypeMetadata(new ImageBuilder()
- .ids(from.id())
- .name(from.name())
- .description(from.description())
- .location(location)
- .status(mapStatus(from.state()))
- .operatingSystem(os))
- .build();
- }
-
- private OsFamily parseOsFamily(String text, OsType fallbackValue) {
- if (text != null)
- try {
- // Attempt parsing OsFamily by scanning name and description
- // @see ProfitBricksComputeServiceAdapter#L190
- OsFamily[] families = OsFamily.values();
- for (OsFamily family : families)
- if (text.contains(family.value()))
- return family;
- } catch (Exception ex) {
- // do nothing
- }
- return mapOsFamily(fallbackValue);
- }
-
- static Image.Status mapStatus(ProvisioningState state) {
- if (state == null)
- return Image.Status.UNRECOGNIZED;
- switch (state) {
- case AVAILABLE:
- return Image.Status.AVAILABLE;
- case DELETED:
- return Image.Status.DELETED;
- case ERROR:
- return Image.Status.ERROR;
- case INACTIVE:
- case INPROCESS:
- return Image.Status.PENDING;
- default:
- return Image.Status.UNRECOGNIZED;
- }
- }
-
- @Override
- public ImageBuilder addTypeMetadata(ImageBuilder builder) {
- return builder.userMetadata(ImmutableMap.of(KEY_PROVISIONABLE_TYPE, Provisionable.Type.SNAPSHOT.toString()));
- }
- }
-
- private interface ImageFunction<T extends Provisionable> extends Function<T, Image> {
-
- ImageBuilder addTypeMetadata(ImageBuilder builder);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/ServerToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/ServerToNodeMetadata.java b/profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/ServerToNodeMetadata.java
deleted file mode 100644
index 9831c6f..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/ServerToNodeMetadata.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * 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.compute.function;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Predicates.not;
-import static com.google.common.collect.Iterables.find;
-import static org.jclouds.location.predicates.LocationPredicates.idEquals;
-
-import java.util.List;
-import java.util.Set;
-
-import org.jclouds.collect.Memoized;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.HardwareBuilder;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.domain.Processor;
-import org.jclouds.compute.domain.Volume;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.domain.Location;
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.domain.Server;
-import org.jclouds.profitbricks.domain.Storage;
-import org.jclouds.util.InetAddresses2.IsPrivateIPAddress;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-
-public class ServerToNodeMetadata implements Function<Server, NodeMetadata> {
-
- private final Function<Storage, Volume> fnVolume;
- private final Supplier<Set<? extends Location>> locations;
- private final Function<List<Nic>, List<String>> fnCollectIps;
- private final ProfitBricksApi api;
-
- private final GroupNamingConvention groupNamingConvention;
-
- @Inject
- ServerToNodeMetadata(Function<Storage, Volume> fnVolume,
- @Memoized Supplier<Set<? extends Location>> locations,
- ProfitBricksApi api,
- GroupNamingConvention.Factory groupNamingConvention) {
- this.fnVolume = fnVolume;
- this.locations = locations;
- this.api = api;
- this.groupNamingConvention = groupNamingConvention.createWithoutPrefix();
- this.fnCollectIps = new Function<List<Nic>, List<String>>() {
- @Override
- public List<String> apply(List<Nic> in) {
- List<String> ips = Lists.newArrayListWithExpectedSize(in.size());
- for (Nic nic : in)
- ips.addAll(nic.ips());
- return ips;
- }
- };
- }
-
- @Override
- public NodeMetadata apply(final Server server) {
- checkNotNull(server, "Null server");
- // Location is not populated in the datacenter on a server response
- DataCenter dataCenter = api.dataCenterApi().getDataCenter(server.dataCenter().id());
- Location location = find(locations.get(), idEquals(dataCenter.location().getId()));
-
- float size = 0f;
- List<Volume> volumes = Lists.newArrayList();
- List<Storage> storages = server.storages();
- if (storages != null)
- for (Storage storage : storages) {
- size += storage.size();
- volumes.add(fnVolume.apply(storage));
- }
-
- // Build hardware
- String id = String.format("cpu=%d,ram=%d,disk=%.0f", server.cores(), server.ram(), size);
- Hardware hardware = new HardwareBuilder()
- .ids(id)
- .name(id)
- .ram(server.ram())
- .processor(new Processor(server.cores(), 1d))
- .hypervisor("kvm")
- .volumes(volumes)
- .location(location)
- .build();
-
- // Collect ips
- List<String> addresses = fnCollectIps.apply(server.nics());
-
- // Build node
- NodeMetadataBuilder nodeBuilder = new NodeMetadataBuilder();
- nodeBuilder.ids(server.id())
- .group(groupNamingConvention.extractGroup(server.name()))
- .hostname(server.hostname())
- .name(server.name())
- .backendStatus(server.state().toString())
- .status(mapStatus(server.status()))
- .hardware(hardware)
- .operatingSystem(mapOsType(server.osType()))
- .location(location)
- .privateAddresses(Iterables.filter(addresses, IsPrivateIPAddress.INSTANCE))
- .publicAddresses(Iterables.filter(addresses, not(IsPrivateIPAddress.INSTANCE)));
-
- return nodeBuilder.build();
- }
-
- static NodeMetadata.Status mapStatus(Server.Status status) {
- if (status == null)
- return NodeMetadata.Status.UNRECOGNIZED;
- switch (status) {
- case SHUTDOWN:
- case SHUTOFF:
- case PAUSED:
- return NodeMetadata.Status.SUSPENDED;
- case RUNNING:
- return NodeMetadata.Status.RUNNING;
- case BLOCKED:
- return NodeMetadata.Status.PENDING;
- case CRASHED:
- return NodeMetadata.Status.ERROR;
- default:
- return NodeMetadata.Status.UNRECOGNIZED;
- }
- }
-
- static OperatingSystem mapOsType(OsType osType) {
- if (osType != null)
- switch (osType) {
- case WINDOWS:
- return OperatingSystem.builder()
- .description(OsFamily.WINDOWS.value())
- .family(OsFamily.WINDOWS)
- .build();
- case LINUX:
- return OperatingSystem.builder()
- .description(OsFamily.LINUX.value())
- .family(OsFamily.LINUX)
- .build();
- }
- return OperatingSystem.builder()
- .description(OsFamily.UNRECOGNIZED.value())
- .family(OsFamily.UNRECOGNIZED)
- .build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/StorageToVolume.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/StorageToVolume.java b/profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/StorageToVolume.java
deleted file mode 100644
index 5557bca..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/StorageToVolume.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.compute.function;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.compute.domain.Volume;
-import org.jclouds.compute.domain.VolumeBuilder;
-import org.jclouds.profitbricks.domain.Storage;
-
-import com.google.common.base.Function;
-
-public class StorageToVolume implements Function<Storage, Volume> {
-
- @Override
- public Volume apply(Storage storage) {
- checkNotNull(storage, "Null storage");
-
- String device = "";
- if (storage.deviceNumber() != null)
- device = storage.deviceNumber().toString();
-
- return new VolumeBuilder()
- .id(storage.id())
- .size(storage.size())
- .bootDevice(storage.bootDevice())
- .device(device)
- .durable(true)
- .type(Volume.Type.LOCAL)
- .build();
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/compute/strategy/AssignDataCenterToTemplate.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/strategy/AssignDataCenterToTemplate.java b/profitbricks/src/main/java/org/jclouds/profitbricks/compute/strategy/AssignDataCenterToTemplate.java
deleted file mode 100644
index f7db219..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/strategy/AssignDataCenterToTemplate.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.compute.strategy;
-
-import static com.google.common.collect.Iterables.find;
-import static org.jclouds.Constants.PROPERTY_USER_THREADS;
-import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.POLL_PREDICATE_DATACENTER;
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.config.CustomizationResponse;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName;
-import org.jclouds.compute.strategy.CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap;
-import org.jclouds.compute.strategy.ListNodesStrategy;
-import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
-import org.jclouds.logging.Logger;
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Location;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Multimap;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- * Attempts to find a valid datacenter in the configured location where the
- * servers will be deployed. If no datacenter is found, one will be created.
- */
-@Beta
-@Singleton
-public class AssignDataCenterToTemplate extends CreateNodesWithGroupEncodedIntoNameThenAddToSet {
-
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- private final ProfitBricksApi api;
- private final Predicate<String> waitDcUntilAvailable;
-
- @Inject
- protected AssignDataCenterToTemplate(
- CreateNodeWithGroupEncodedIntoName addNodeWithGroupStrategy,
- ListNodesStrategy listNodesStrategy,
- GroupNamingConvention.Factory namingConvention,
- @Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory,
- ProfitBricksApi api, @Named(POLL_PREDICATE_DATACENTER) Predicate<String> waitDcUntilAvailable) {
- super(addNodeWithGroupStrategy, listNodesStrategy, namingConvention, userExecutor,
- customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory);
- this.api = api;
- this.waitDcUntilAvailable = waitDcUntilAvailable;
- }
-
- @Override
- public Map<?, ListenableFuture<Void>> execute(String group, int count, final Template template,
- Set<NodeMetadata> goodNodes, Map<NodeMetadata, Exception> badNodes,
- Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {
-
- logger.info(">> looking for a datacenter in %s", template.getLocation().getId());
-
- // Try to find an existing datacenter in the selected location
- DataCenter dataCenter = find(api.dataCenterApi().getAllDataCenters(), new Predicate<DataCenter>() {
- @Override
- public boolean apply(DataCenter input) {
- // The location field is not populated when getting the list of datacenters
- DataCenter details = api.dataCenterApi().getDataCenter(input.id());
- return details != null && template.getLocation().getId().equals(details.location().getId());
- }
- }, null);
-
- if (dataCenter == null) {
- String name = namingConvention.create().sharedNameForGroup(group);
- logger.info(">> no datacenter was found. Creating a new one named %s in %s...", name, template.getLocation()
- .getId());
- dataCenter = api.dataCenterApi().createDataCenter(
- DataCenter.Request.creatingPayload(name, Location.fromId(template.getLocation().getId())));
- waitDcUntilAvailable.apply(dataCenter.id());
- }
-
- return super.execute(group, count, new TemplateWithDataCenter(template, dataCenter), goodNodes, badNodes,
- customizationResponses);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/compute/strategy/TemplateWithDataCenter.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/strategy/TemplateWithDataCenter.java b/profitbricks/src/main/java/org/jclouds/profitbricks/compute/strategy/TemplateWithDataCenter.java
deleted file mode 100644
index dd689d5..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/compute/strategy/TemplateWithDataCenter.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.domain.Location;
-import org.jclouds.profitbricks.domain.DataCenter;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Extends the default {@link Template} object to provide the {@link DataCenter}
- * where the nodes must be created.
- */
-@Beta
-public class TemplateWithDataCenter implements Template {
-
- private final Template delegate;
-
- private final DataCenter dataCenter;
-
- // For internal use only
- TemplateWithDataCenter(Template delegate, DataCenter dataCenter) {
- this.delegate = checkNotNull(delegate, "delegate cannot be null");
- this.dataCenter = checkNotNull(dataCenter, "dataCenter cannot be null");
- }
-
- public DataCenter getDataCenter() {
- return dataCenter;
- }
-
- public Template clone() {
- return new TemplateWithDataCenter(delegate.clone(), dataCenter);
- }
-
- public Hardware getHardware() {
- return delegate.getHardware();
- }
-
- public Image getImage() {
- return delegate.getImage();
- }
-
- public Location getLocation() {
- return delegate.getLocation();
- }
-
- public TemplateOptions getOptions() {
- return delegate.getOptions();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((dataCenter == null) ? 0 : dataCenter.hashCode());
- result = prime * result + ((delegate == null) ? 0 : delegate.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- TemplateWithDataCenter other = (TemplateWithDataCenter) obj;
- if (dataCenter == null) {
- if (other.dataCenter != null)
- return false;
- } else if (!dataCenter.equals(other.dataCenter))
- return false;
- if (delegate == null) {
- if (other.delegate != null)
- return false;
- } else if (!delegate.equals(other.delegate))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return delegate.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/config/ProfitBricksComputeProperties.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/config/ProfitBricksComputeProperties.java b/profitbricks/src/main/java/org/jclouds/profitbricks/config/ProfitBricksComputeProperties.java
deleted file mode 100644
index eadc038..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/config/ProfitBricksComputeProperties.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.config;
-
-public class ProfitBricksComputeProperties {
-
- public static final String POLL_PREDICATE_DATACENTER = "jclouds.profitbricks.predicate.datacenter";
- public static final String POLL_PREDICATE_SNAPSHOT = "jclouds.profitbricks.predicate.snapshot";
-
- public static final String TIMEOUT_DATACENTER_AVAILABLE = "jclouds.profitbricks.timeout.datacenter-available";
- public static final String POLL_INITIAL_PERIOD = "jclouds.profitbricks.poll-status.initial-period";
- public static final String POLL_MAX_PERIOD = "jclouds.profitbricks.poll-status.poll.max-period";
-
- private ProfitBricksComputeProperties() {
- throw new AssertionError("Intentionally unimplemented");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/config/ProfitBricksHttpApiModule.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/config/ProfitBricksHttpApiModule.java b/profitbricks/src/main/java/org/jclouds/profitbricks/config/ProfitBricksHttpApiModule.java
deleted file mode 100644
index f95b1b3..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/config/ProfitBricksHttpApiModule.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.config;
-
-import org.jclouds.http.HttpCommandExecutorService;
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.handlers.ProfitBricksHttpErrorHandler;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.http.config.ConfiguresHttpCommandExecutorService;
-import org.jclouds.http.config.SSLModule;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.profitbricks.domain.ServiceFault;
-import org.jclouds.profitbricks.http.ResponseStatusFromPayloadHttpCommandExecutorService;
-import org.jclouds.profitbricks.http.parser.ServiceFaultResponseHandler;
-import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.config.HttpApiModule;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Injector;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-
-/**
- * Configures the ProfitBricks connection.
- */
-@ConfiguresHttpApi
-public class ProfitBricksHttpApiModule extends HttpApiModule<ProfitBricksApi> {
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ProfitBricksHttpErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ProfitBricksHttpErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ProfitBricksHttpErrorHandler.class);
- }
-
- @ConfiguresHttpCommandExecutorService
- public static class ProfitBricksHttpCommandExecutorServiceModule extends AbstractModule {
-
- @Override
- protected void configure() {
- install(new SSLModule());
- bind(HttpCommandExecutorService.class).to(ResponseStatusFromPayloadHttpCommandExecutorService.class)
- .in(Scopes.SINGLETON);
- }
-
- @Provides
- public ParseSax<ServiceFault> serviceFaultParser(ParseSax.Factory factory, Injector injector) {
- return factory.create(injector.getInstance(ServiceFaultResponseHandler.class));
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/domain/AvailabilityZone.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/AvailabilityZone.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/AvailabilityZone.java
deleted file mode 100644
index a3c50ae..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/AvailabilityZone.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.common.base.Enums;
-
-public enum AvailabilityZone {
-
- AUTO, ZONE_1, ZONE_2, UNRECOGNIZED;
-
- public String value() {
- return name();
- }
-
- public static AvailabilityZone fromValue(String v) {
- return Enums.getIfPresent(AvailabilityZone.class, v).or(UNRECOGNIZED);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/domain/DataCenter.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/DataCenter.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/DataCenter.java
deleted file mode 100644
index 9bb09ab..0000000
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/DataCenter.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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 static org.jclouds.profitbricks.util.Preconditions.checkInvalidChars;
-
-import java.util.List;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.auto.value.AutoValue;
-import com.google.common.collect.ImmutableList;
-
-@AutoValue
-public abstract class DataCenter {
-
- public abstract String id();
-
- @Nullable
- public abstract String name();
-
- public abstract int version();
-
- @Nullable
- public abstract ProvisioningState state();
-
- @Nullable
- public abstract Location location();
-
- @Nullable
- public abstract List<Server> servers();
-
- @Nullable
- public abstract List<Storage> storages();
-
- public static Builder builder() {
- return new AutoValue_DataCenter.Builder()
- .servers(ImmutableList.<Server>of())
- .storages(ImmutableList.<Storage>of());
- }
-
- public abstract Builder toBuilder();
-
- @AutoValue.Builder
- public abstract static class Builder {
-
- public abstract Builder id(String id);
-
- public abstract Builder name(String name);
-
- public abstract Builder version(int version);
-
- public abstract Builder state(ProvisioningState state);
-
- public abstract Builder location(Location location);
-
- public abstract Builder servers(List<Server> servers);
-
- public abstract Builder storages(List<Storage> storages);
-
- abstract DataCenter autoBuild();
-
- public DataCenter build(){
- DataCenter built = autoBuild();
- return built.toBuilder()
- .servers(ImmutableList.copyOf(built.servers()))
- .storages(ImmutableList.copyOf(built.storages()))
- .autoBuild();
- }
-
- }
-
- public static final class Request {
-
- public static CreatePayload creatingPayload(String name, Location location) {
- CreatePayload payload = new AutoValue_DataCenter_Request_CreatePayload(name, location);
- checkInvalidChars(payload.name());
-
- return payload;
- }
-
- public static UpdatePayload updatingPayload(String id, String name) {
- UpdatePayload payload = new AutoValue_DataCenter_Request_UpdatePayload(id, name);
- checkInvalidChars(payload.name());
-
- return payload;
- }
-
- @AutoValue
- public abstract static class CreatePayload {
-
- public abstract String name();
-
- public abstract Location location();
-
- }
-
- @AutoValue
- public abstract static class UpdatePayload {
-
- public abstract String id();
-
- public abstract String name();
-
- }
- }
-}
[04/11] jclouds-labs git commit: Remove ProfitBricks
Posted by de...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiLiveTest.java
deleted file mode 100644
index 12670cd..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiLiveTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import com.google.common.collect.Iterables;
-
-import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.IpBlock;
-import org.jclouds.profitbricks.domain.Nic;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", testName = "IpBlockApiLiveTest")
-public class IpBlockApiLiveTest extends BaseProfitBricksLiveTest {
-
- private DataCenter dataCenter;
- private Nic nic;
-
- private IpBlock newIpBlock;
-
- @BeforeClass
- public void setupTest() {
- dataCenter = findOrCreateDataCenter("ipBlockApiLiveTest" + System.currentTimeMillis());
- nic = findOrCreateNic(dataCenter);
- }
-
- @Test
- public void testReservePublicIpBlock() {
- assertDataCenterAvailable(dataCenter);
- newIpBlock = api.ipBlockApi().reservePublicIpBlock(1, testLocation);
-
- assertNotNull(newIpBlock);
- assertFalse(newIpBlock.ips().isEmpty());
- }
-
- @Test(dependsOnMethods = "testReservePublicIpBlock")
- public void testGetAllIpBlocks() {
- List<IpBlock> ipBlocks = api.ipBlockApi().getAllIpBlock();
-
- assertNotNull(ipBlocks);
- assertFalse(ipBlocks.isEmpty());
- }
-
- @Test(dependsOnMethods = "testReservePublicIpBlock")
- public void testGetOneIpBlock() {
- IpBlock ipBlock = api.ipBlockApi().getIpBlock(newIpBlock.id());
-
- assertNotNull(ipBlock);
- }
-
- @Test(dependsOnMethods = "testReservePublicIpBlock")
- public void testAddPublicIpToNic() {
- assertDataCenterAvailable(dataCenter);
- String ipToAdd = Iterables.getFirst(newIpBlock.ips(), null);
- String requestId = api.ipBlockApi().addPublicIpToNic(
- ipToAdd, nic.id());
-
- assertNotNull(requestId);
- assertDataCenterAvailable(dataCenter);
- List<String> ips = api.nicApi().getNic(nic.id()).ips();
- assertTrue(ips.contains(ipToAdd), "NIC didn't contain added public ip");
- }
-
- @Test(dependsOnMethods = "testAddPublicIpToNic")
- public void testRemovePublicIpFromNic() {
- assertDataCenterAvailable(dataCenter);
- String ipToRemove = Iterables.getFirst(newIpBlock.ips(), null);
- String requestId = api.ipBlockApi().removePublicIpFromNic(
- ipToRemove, nic.id());
-
- assertNotNull(requestId);
- assertDataCenterAvailable(dataCenter);
- List<String> ips = api.nicApi().getNic(nic.id()).ips();
- assertFalse(ips.contains(ipToRemove), "NIC still contains removed public ip");
- }
-
- @Test(dependsOnMethods = "testRemovePublicIpFromNic")
- public void testReleasePublicIpBlock() {
- assertDataCenterAvailable(dataCenter);
- String requestId = api.ipBlockApi().releasePublicIpBlock(newIpBlock.id());
-
- assertNotNull(requestId);
- }
-
- @AfterClass(alwaysRun = true)
- public void cleanUp() {
- destroyDataCenter(dataCenter);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiMockTest.java
deleted file mode 100644
index 234f163..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiMockTest.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * 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.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-import java.util.List;
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.IpBlock;
-import org.jclouds.profitbricks.domain.Location;
-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.Assert.assertTrue;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "IpBlockApiMockTest")
-public class IpBlockApiMockTest extends BaseProfitBricksMockTest {
-
- @Test
- public void testGetOneIpBlock() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblock.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- IpBlockApi api = pbApi.ipBlockApi();
-
- String id = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
- String content = "<ws:getPublicIpBlock><blockId>" + id + "</blockId></ws:getPublicIpBlock>";
-
- try {
- IpBlock ipBlock = api.getIpBlock(id);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(ipBlock);
- assertEquals(ipBlock.id(), id);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetNonExisingIpBlock() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- IpBlockApi api = pbApi.ipBlockApi();
-
- String id = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
- try {
- IpBlock ipBlock = api.getIpBlock(id);
- assertRequestHasCommonProperties(server.takeRequest());
- assertNull(ipBlock);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetAllIpBlock() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblocks.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- IpBlockApi api = pbApi.ipBlockApi();
-
- try {
- List<IpBlock> ipBlocks = api.getAllIpBlock();
- assertRequestHasCommonProperties(server.takeRequest());
- assertNotNull(ipBlocks);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetAllIpBlockReturning404() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- IpBlockApi api = pbApi.ipBlockApi();
-
- try {
- List<IpBlock> ipBlocks = api.getAllIpBlock();
- assertRequestHasCommonProperties(server.takeRequest());
- assertTrue(ipBlocks.isEmpty());
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testReservePublicIpBlock() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblock-reserve.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- IpBlockApi api = pbApi.ipBlockApi();
-
- int blockSize = 2;
- Location location = Location.US_LAS;
-
- String content = "<ws:reservePublicIpBlock><request><blockSize>" + blockSize + "</blockSize><location>" + location.getId() + "</location></request></ws:reservePublicIpBlock>";
- try {
- IpBlock ipBlock = api.reservePublicIpBlock(blockSize, location);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(ipBlock);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testAddPublicIpToNic() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblock-addtonic.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- IpBlockApi api = pbApi.ipBlockApi();
-
- String ip = "2";
- String nicid = "nicid";
-
- String content = "<ws:addPublicIpToNic><ip>" + ip + "</ip><nicId>" + nicid + "</nicId></ws:addPublicIpToNic>";
- try {
- String requestId = api.addPublicIpToNic(ip, nicid);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(requestId);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testRemovePublicIpFromNic() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblock-removefromnic.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- IpBlockApi api = pbApi.ipBlockApi();
-
- String ip = "2";
- String nicid = "nicid";
-
- String content = "<ws:removePublicIpFromNic><ip>" + ip + "</ip><nicId>" + nicid + "</nicId></ws:removePublicIpFromNic>";
- try {
- String requestId = api.removePublicIpFromNic(ip, nicid);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(requestId);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testReleasePublicIpBlock() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblock-release.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- IpBlockApi api = pbApi.ipBlockApi();
-
- String blockid = "2";
-
- String content = "<ws:releasePublicIpBlock><blockId>" + blockid + "</blockId></ws:releasePublicIpBlock>";
- try {
- String requestId = api.releasePublicIpBlock(blockid);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(requestId);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 0780f78..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadBalancerApiLiveTest.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-import java.util.Objects;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-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.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "LoadBalancerApiLiveTest")
-public class LoadBalancerApiLiveTest extends BaseProfitBricksLiveTest {
-
- private DataCenter dataCenter;
- private Server server;
-
- private String loadBalancerId;
-
- @BeforeClass
- public void setupTest() {
- dataCenter = findOrCreateDataCenter("loadBalancerApiLiveTest" + System.currentTimeMillis());
- server = findOrCreateServer(dataCenter);
- }
-
- @Test
- public void testCreateLoadBalancer() {
- assertDataCenterAvailable(dataCenter);
- String createdId = api.loadBalancerApi().createLoadBalancer(
- LoadBalancer.Request.creatingBuilder()
- .dataCenterId(dataCenter.id())
- .name("testName")
- .algorithm(Algorithm.ROUND_ROBIN)
- .ip("192.168.0.200")
- .lanId(1)
- .build()
- );
-
- assertNotNull(createdId);
- assertDataCenterAvailable(dataCenter);
- this.loadBalancerId = createdId;
- }
-
- @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);
- assertEquals(loadBalancer.id(), loadBalancerId);
- }
-
- @Test(dependsOnMethods = "testGetLoadBalancer")
- public void testRegisterLoadBalancer() {
- assertDataCenterAvailable(dataCenter);
- LoadBalancer loadBalancer = api.loadBalancerApi().registerLoadBalancer(
- LoadBalancer.Request
- .createRegisteringPaylod(loadBalancerId, ImmutableList.of(server.id()))
- );
-
- assertNotNull(loadBalancer);
- assertDataCenterAvailable(dataCenter);
- Optional<Server> balancedServer = Iterables.tryFind(loadBalancer.balancedServers(), new Predicate<Server>() {
-
- @Override
- public boolean apply(Server t) {
- return Objects.equals(t.id(), server.id());
- }
- });
- assertTrue(balancedServer.isPresent(), "Server input wasn't registered to loadbalancer");
- }
-
- @Test(dependsOnMethods = "testRegisterLoadBalancer")
- public void testDeregisterLoadBalancer() {
- assertDataCenterAvailable(dataCenter);
- String requestId = api.loadBalancerApi().deregisterLoadBalancer(
- LoadBalancer.Request
- .createDeregisteringPayload(loadBalancerId, ImmutableList.of(server.id()))
- );
-
- assertNotNull(requestId);
- assertDataCenterAvailable(dataCenter);
- LoadBalancer loadBalancer = api.loadBalancerApi().getLoadBalancer(loadBalancerId);
- Optional<Server> balancedServer = Iterables.tryFind(loadBalancer.balancedServers(), new Predicate<Server>() {
-
- @Override
- public boolean apply(Server t) {
- return Objects.equals(t.id(), loadBalancerId);
- }
- });
- assertFalse(balancedServer.isPresent(), "Server input wasn't deregistered from loadbalancer");
- }
-
- @Test(dependsOnMethods = "testDeregisterLoadBalancer")
- public void testUpdateLoadBalancer() {
- assertDataCenterAvailable(dataCenter);
- String newName = "whatever";
- String requestId = api.loadBalancerApi().updateLoadBalancer(
- LoadBalancer.Request.updatingBuilder()
- .id(loadBalancerId)
- .name(newName)
- .build()
- );
-
- assertNotNull(requestId);
- assertDataCenterAvailable(dataCenter);
- LoadBalancer loadBalancer = api.loadBalancerApi().getLoadBalancer(loadBalancerId);
- assertEquals(loadBalancer.name(), newName);
- }
-
- @Test(dependsOnMethods = "testUpdateLoadBalancer")
- public void testDeleteLoadBalancer() {
- assertDataCenterAvailable(dataCenter);
- boolean result = api.loadBalancerApi().deleteLoadBalancer(loadBalancerId);
- assertTrue(result, "Test load balancer wasn't deleted");
- }
-
- @AfterClass(alwaysRun = true)
- public void cleanUp() {
- destroyDataCenter(dataCenter);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index e4e8fd7..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadBalancerApiMockTest.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.List;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import com.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-
-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 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>3</lanId>"
- + "<serverIds>server-ids</serverIds>"
- + "</request>"
- + "</ws:createLoadBalancer>";
-
- try {
- List<String> serverIds = Lists.newArrayList();
- serverIds.add("server-ids");
- String loadBalancerId = api.createLoadBalancer(LoadBalancer.Request.creatingBuilder()
- .dataCenterId("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeeee")
- .name("load-balancer-name")
- .algorithm(Algorithm.ROUND_ROBIN)
- .ip("192.168.0.1")
- .lanId(3)
- .serverIds(serverIds)
- .build());
-
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertEquals(loadBalancerId, "1234-1234-1234-1234");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testUpdateLoadBalancer() 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 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)
- .name("load-balancer-name")
- .algorithm(Algorithm.ROUND_ROBIN)
- .ip("192.168.0.1")
- .build();
-
- String requestId = api.updateLoadBalancer(toUpdate);
-
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertEquals(requestId, "request-id");
- } 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>"
- + "<loadBalancerId>1234</loadBalancerId>"
- + "<serverIds>1</serverIds>"
- + "<serverIds>2</serverIds>"
- + "</ws:registerServersOnLoadBalancer>";
-
- try {
- List<String> serverIds = Lists.newArrayList();
- serverIds.add("1");
- serverIds.add("2");
- LoadBalancer.Request.RegisterPayload payload = LoadBalancer.Request
- .createRegisteringPaylod("1234", serverIds);
-
- LoadBalancer loadBalancer = api.registerLoadBalancer(payload);
-
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(loadBalancer);
- assertEquals(loadBalancer.id(), "load-balancer-id");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDeregisterLoadBalancer() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancer-deregister.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- LoadBalancerApi api = pbApi.loadBalancerApi();
-
- String content = "<ws:deregisterServersOnLoadBalancer>"
- + "<serverIds>1</serverIds>"
- + "<serverIds>2</serverIds>"
- + "<loadBalancerId>load-balancer-id</loadBalancerId>"
- + "</ws:deregisterServersOnLoadBalancer>";
-
- try {
- LoadBalancer.Request.DeregisterPayload payload = LoadBalancer.Request
- .createDeregisteringPayload("load-balancer-id", ImmutableList.of("1", "2"));
-
- String requestId = api.deregisterLoadBalancer(payload);
-
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertEquals(requestId, "request-id");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDeleteLoadBalancer() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancer-delete.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/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiLiveTest.java
deleted file mode 100644
index 5253d1f..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiLiveTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.domain.Server;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeClass;
-
-@Test(groups = "live", testName = "NicApiLiveTest")
-public class NicApiLiveTest extends BaseProfitBricksLiveTest {
-
- private DataCenter dataCenter;
- private Server server;
-
- private String createdNicId;
-
- @BeforeClass
- public void setupTest() {
- dataCenter = findOrCreateDataCenter("nicApiLiveTest-" + System.currentTimeMillis());
- server = findOrCreateServer(dataCenter);
- }
-
- @Test
- public void testCreateNic() {
- assertDataCenterAvailable(dataCenter);
- String nicId = api.nicApi().createNic(Nic.Request.creatingBuilder()
- .name("name nr1")
- .dhcpActive(true)
- .serverId(server.id())
- .lanId(1)
- .build());
-
- assertNotNull(nicId);
- assertDataCenterAvailable(dataCenter);
-
- this.createdNicId = nicId;
- }
-
- @Test(dependsOnMethods = "testCreateNic")
- public void testGetAllNics() {
- List<Nic> nics = api.nicApi().getAllNics();
-
- assertNotNull(nics);
- }
-
- @Test(dependsOnMethods = "testCreateNic")
- public void testGetNic() {
- Nic nic = api.nicApi().getNic(createdNicId);
-
- assertNotNull(nic);
- assertEquals(nic.id(), createdNicId);
- }
-
- @Test(dependsOnMethods = "testGetNic")
- public void testUpdateNic() {
- assertDataCenterAvailable(dataCenter);
- String newName = "name nr2";
- String requestId = api.nicApi().updateNic(
- Nic.Request.updatingBuilder()
- .name("name nr2")
- .id(createdNicId)
- .build()
- );
-
- assertNotNull(requestId);
- assertDataCenterAvailable(dataCenter);
-
- Nic nic = api.nicApi().getNic(createdNicId);
- assertEquals(nic.name(), newName);
- }
-
- @Test(dependsOnMethods = "testUpdateNic")
- public void testSetInternetAccess() {
- assertDataCenterAvailable(dataCenter);
-
- String requestId = api.nicApi().setInternetAccess(Nic.Request.setInternetAccessBuilder()
- .dataCenterId(dataCenter.id())
- .lanId(1)
- .internetAccess(true)
- .build()
- );
- assertDataCenterAvailable(dataCenter);
- assertNotNull(requestId);
-
- Nic nic = api.nicApi().getNic(createdNicId);
- assertTrue(nic.internetAccess(), "Expected nic to have internet access");
- }
-
- @Test(dependsOnMethods = "testSetInternetAccess")
- public void testDeleteNic() {
- assertDataCenterAvailable(dataCenter);
- boolean result = api.nicApi().deleteNic(createdNicId);
- assertTrue(result, "Created test NIC was not deleted.");
- }
-
- @AfterClass(alwaysRun = true)
- public void cleanUp() {
- destroyDataCenter(dataCenter);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiMockTest.java
deleted file mode 100644
index 940efa7..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiMockTest.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import com.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "NicApiMockTest")
-
-public class NicApiMockTest extends BaseProfitBricksMockTest {
-
- @Test
- public void testGetNic() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/nic/nic.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- NicApi api = pbApi.nicApi();
-
- String id = "12345678-abcd-efgh-ijkl-987654321000";
-
- String content = "<ws:getNic><nicId>" + id + "</nicId></ws:getNic>";
- try {
- Nic nic = api.getNic(id);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(nic);
- assertEquals(nic.id(), id);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetNonExistingNic() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- NicApi api = pbApi.nicApi();
-
- String id = "nonexisting-nic-id";
-
- try {
- Nic nic = api.getNic(id);
- assertRequestHasCommonProperties(server.takeRequest());
- assertNull(nic);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetAllNic() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/nic/nics.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- NicApi api = pbApi.nicApi();
- try {
- List<Nic> nics = api.getAllNics();
- assertRequestHasCommonProperties(server.takeRequest(), "<ws:getAllNic/>");
- assertNotNull(nics);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testCreateNic() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/nic/nic-create.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- NicApi api = pbApi.nicApi();
-
- String content = "<ws:createNic>"
- + "<request>"
- + "<ip>192.168.0.1</ip>"
- + "<nicName>nic-name</nicName>"
- + "<dhcpActive>true</dhcpActive>"
- + "<serverId>server-id</serverId>"
- + "<lanId>1</lanId>"
- + "</request>"
- + "</ws:createNic>";
-
- try {
- String nicId = api.createNic(
- Nic.Request.creatingBuilder()
- .ip("192.168.0.1")
- .name("nic-name")
- .dhcpActive(true)
- .lanId(1)
- .serverId("server-id")
- .build());
-
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(nicId);
-
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testUpdateNic() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/nic/nic-update.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- NicApi api = pbApi.nicApi();
-
- String content = "<ws:updateNic>"
- + "<request>"
- + "<nicId>nic-id</nicId>"
- + "<ip>10.0.0.1</ip>"
- + "<nicName>nic-name</nicName>"
- + "<dhcpActive>true</dhcpActive>"
- + "<lanId>1</lanId>"
- + "</request>"
- + "</ws:updateNic>";
- try {
- String requestId = api.updateNic(Nic.Request.updatingBuilder()
- .id("nic-id")
- .ip("10.0.0.1")
- .name("nic-name")
- .dhcpActive(true)
- .lanId(1)
- .build());
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertEquals(requestId, "request-id");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testSetInternetAccess() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/nic/nic-internetaccess.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- NicApi api = pbApi.nicApi();
-
- String content = "<ws:setInternetAccess>"
- + "<dataCenterId>datacenter-id</dataCenterId>"
- + "<lanId>1</lanId>"
- + "<internetAccess>true</internetAccess>"
- + "</ws:setInternetAccess>";
- try {
- String requestId = api.setInternetAccess(Nic.Request.setInternetAccessBuilder()
- .dataCenterId("datacenter-id")
- .lanId(1)
- .internetAccess(true)
- .build());
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertEquals(requestId, "request-id");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDeleteNic() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/nic/nic-delete.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- NicApi api = pbApi.nicApi();
-
- String id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
-
- String content = "<ws:deleteNic><nicId>" + id + "</nicId></ws:deleteNic>";
-
- try {
- boolean result = api.deleteNic(id);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertTrue(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDeleteNonExistingNic() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- NicApi api = pbApi.nicApi();
-
- String id = "nonexisting-nic-id";
-
- try {
- boolean result = api.deleteNic(id);
- assertRequestHasCommonProperties(server.takeRequest());
- assertFalse(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiLiveTest.java
deleted file mode 100644
index be1a60c..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiLiveTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.domain.Server;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", testName = "ServerApiLiveTest")
-public class ServerApiLiveTest extends BaseProfitBricksLiveTest {
-
- private DataCenter dataCenter;
- private String createdServerId;
-
- @BeforeClass
- public void setupTest() {
- dataCenter = findOrCreateDataCenter("serverApiLiveTest-" + System.currentTimeMillis());
- }
-
- @Test
- public void testCreateServer() {
- assertDataCenterAvailable(dataCenter);
- String serverId = api.serverApi().createServer(
- Server.Request.creatingBuilder()
- .dataCenterId(dataCenter.id())
- .name("jclouds-node")
- .cores(1)
- .ram(1024)
- .build());
-
- assertNotNull(serverId);
- assertDataCenterAvailable(dataCenter);
- assertNodeRunning(serverId);
-
- this.createdServerId = serverId;
- }
-
- @Test(dependsOnMethods = "testCreateServer")
- public void testGetServer() {
- Server server = api.serverApi().getServer(createdServerId);
-
- assertNotNull(server);
- assertEquals(server.id(), createdServerId);
- }
-
- @Test(dependsOnMethods = "testCreateServer")
- public void testGetAllServers() {
- List<Server> servers = api.serverApi().getAllServers();
-
- assertNotNull(servers);
- assertFalse(servers.isEmpty());
- }
-
- @Test(dependsOnMethods = "testGetServer")
- public void testUpdateServer() {
- assertDataCenterAvailable(dataCenter);
- String requestId = api.serverApi().updateServer(
- Server.Request.updatingBuilder()
- .id(createdServerId)
- .name("apache-node")
- .cores(2)
- .ram(2 * 1024)
- .build());
-
- assertNotNull(requestId);
- assertDataCenterAvailable(dataCenter);
-
- Server server = api.serverApi().getServer(createdServerId);
- assertEquals(server.state(), ProvisioningState.AVAILABLE);
- }
-
- @Test(dependsOnMethods = "testUpdateServer")
- public void testStopServer() {
- String requestId = api.serverApi().stopServer(createdServerId);
- assertNotNull(requestId);
- assertNodeSuspended(createdServerId);
-
- Server server = api.serverApi().getServer(createdServerId);
- assertEquals(server.status(), Server.Status.SHUTOFF);
- }
-
- @Test(dependsOnMethods = "testStopServer")
- public void testStartServer() {
- String requestId = api.serverApi().startServer(createdServerId);
- assertNotNull(requestId);
- assertNodeRunning(createdServerId);
-
- Server server = api.serverApi().getServer(createdServerId);
- assertEquals(server.status(), Server.Status.RUNNING);
- }
-
- @Test(dependsOnMethods = "testStartServer")
- public void testDeleteServer() {
- assertDataCenterAvailable(dataCenter);
- boolean result = api.serverApi().deleteServer(createdServerId);
- assertTrue(result, "Created test server was not deleted.");
- }
-
- @AfterClass(alwaysRun = true)
- public void cleanUp() {
- destroyDataCenter(dataCenter);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiMockTest.java
deleted file mode 100644
index 47738b8..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiMockTest.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * 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 static org.jclouds.profitbricks.internal.BaseProfitBricksMockTest.mockWebServer;
-
-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.AvailabilityZone;
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.domain.Server;
-import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
-import org.jclouds.rest.ResourceNotFoundException;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ServerApiMockTest")
-public class ServerApiMockTest extends BaseProfitBricksMockTest {
-
- @Test
- public void testGetAllServers() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/server/servers.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ServerApi api = pbApi.serverApi();
-
- try {
- List<Server> servers = api.getAllServers();
- assertRequestHasCommonProperties(server.takeRequest(), "<ws:getAllServers/>");
- assertNotNull(servers);
- assertTrue(servers.size() == 2);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetAllServersReturning404() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ServerApi api = pbApi.serverApi();
-
- try {
- List<Server> servers = api.getAllServers();
- assertRequestHasCommonProperties(server.takeRequest());
- assertTrue(servers.isEmpty());
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetServer() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/server/server.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ServerApi api = pbApi.serverApi();
-
- String id = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
- String content = "<ws:getServer><serverId>" + id + "</serverId></ws:getServer>";
- try {
- Server svr = api.getServer(id);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(svr);
- assertEquals(svr.id(), id);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetNonExistingServer() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ServerApi api = pbApi.serverApi();
-
- String id = "random-non-existing-id";
- try {
- Server srvr = api.getServer(id);
- assertRequestHasCommonProperties(server.takeRequest());
- assertNull(srvr);
-
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testStartServer() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/server/server-start.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ServerApi api = pbApi.serverApi();
-
- String id = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
- String content = "<ws:startServer><serverId>" + id + "</serverId></ws:startServer>";
- try {
- String requestId = api.startServer(id);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertEquals(requestId, "123456");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testStartNonExistingServer() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(500).setBody(payloadFromResource("/fault-404.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ServerApi api = pbApi.serverApi();
-
- String id = "random-non-existing-id";
- try {
- String requestId = api.startServer(id);
- assertRequestHasCommonProperties(server.takeRequest());
- fail("Should've failed.");
- } catch (ResourceNotFoundException ex) {
- // expected exception
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testStopServer() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/server/server-stop.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ServerApi api = pbApi.serverApi();
-
- String id = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
- String content = "<ws:stopServer><serverId>" + id + "</serverId></ws:stopServer>";
- try {
- String requestId = api.stopServer(id);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertEquals(requestId, "123456");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testResetServer() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/server/server-reset.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ServerApi api = pbApi.serverApi();
-
- String id = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
- String content = "<ws:resetServer><serverId>" + id + "</serverId></ws:resetServer>";
- try {
- String requestId = api.resetServer(id);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertEquals(requestId, "123456");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testCreateServer() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/server/server-create.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ServerApi api = pbApi.serverApi();
-
- String dataCenterId = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
- String name = "jclouds-node";
- String imageId = "some-random-image-id";
-
- String content = "<ws:createServer>"
- + "<request>"
- + "<dataCenterId>" + dataCenterId + "</dataCenterId>"
- + "<cores>4</cores>"
- + "<ram>4096</ram>"
- + "<serverName>" + name + "</serverName>"
- // + "<bootFromStorageId></bootFromStorageId>"
- + "<bootFromImageId>" + imageId + "</bootFromImageId>"
- + "<internetAccess>true</internetAccess>"
- + "<lanId>2</lanId>"
- + "<osType>LINUX</osType>"
- + "<availabilityZone>ZONE_1</availabilityZone>"
- + "<cpuHotPlug>true</cpuHotPlug>"
- + "<ramHotPlug>false</ramHotPlug>"
- + "<nicHotPlug>true</nicHotPlug>"
- + "<nicHotUnPlug>false</nicHotUnPlug>"
- + "<discVirtioHotPlug>true</discVirtioHotPlug>"
- + "<discVirtioHotUnPlug>false</discVirtioHotUnPlug>"
- + "</request>"
- + "</ws:createServer>";
-
- try {
- String serverId = api.createServer(Server.Request.creatingBuilder()
- .dataCenterId(dataCenterId)
- .name(name)
- .cores(4)
- .ram(4 * 1024)
- .bootFromImageId(imageId)
- .hasInternetAccess(Boolean.TRUE)
- .lanId(2)
- .osType(OsType.LINUX)
- .availabilityZone(AvailabilityZone.ZONE_1)
- .isCpuHotPlug(Boolean.TRUE)
- .isRamHotPlug(Boolean.FALSE)
- .isNicHotPlug(Boolean.TRUE)
- .isNicHotUnPlug(Boolean.FALSE)
- .isDiscVirtioHotPlug(Boolean.TRUE)
- .isDiscVirtioHotUnPlug(Boolean.FALSE)
- .build());
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(serverId);
- assertEquals(serverId, "qwertyui-qwer-qwer-qwer-qwertyyuiiop");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testUpdateServer() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/server/server-update.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ServerApi api = pbApi.serverApi();
-
- String serverId = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
- String newName = "apache-node";
- String storageId = "some-random-storage-id";
-
- String content = "<ws:updateServer>"
- + "<request>"
- + "<serverId>" + serverId + "</serverId>"
- + "<cores>8</cores>"
- + "<ram>8192</ram>"
- + "<serverName>" + newName + "</serverName>"
- + "<bootFromStorageId>" + storageId + "</bootFromStorageId>"
- // + "<bootFromImageId>?</bootFromImageId>"
- + "<osType>OTHER</osType>"
- + "<availabilityZone>AUTO</availabilityZone>"
- + "<cpuHotPlug>false</cpuHotPlug>"
- + "<ramHotPlug>true</ramHotPlug>"
- + "<nicHotPlug>false</nicHotPlug>"
- + "<nicHotUnPlug>true</nicHotUnPlug>"
- + "<discVirtioHotPlug>false</discVirtioHotPlug>"
- + "<discVirtioHotUnPlug>true</discVirtioHotUnPlug>"
- + "</request>"
- + "</ws:updateServer>";
- try {
- String requestId = api.updateServer(Server.Request.updatingBuilder()
- .id(serverId)
- .name(newName)
- .cores(8)
- .ram(8 * 1024)
- .bootFromStorageId(storageId)
- .osType(OsType.OTHER)
- .availabilityZone(AvailabilityZone.AUTO)
- .isCpuHotPlug(false)
- .isRamHotPlug(true)
- .isNicHotPlug(false)
- .isNicHotUnPlug(true)
- .isDiscVirtioHotPlug(false)
- .isDiscVirtioHotUnPlug(true)
- .build());
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(requestId);
- assertEquals(requestId, "102458");
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDeleteServer() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/server/server-delete.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ServerApi api = pbApi.serverApi();
-
- String serverId = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
- String content = "<ws:deleteServer><serverId>" + serverId + "</serverId></ws:deleteServer>";
- try {
- boolean result = api.deleteServer(serverId);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertTrue(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
-
- }
-
- @Test
- public void testDeleteNonExistingServer() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ServerApi api = pbApi.serverApi();
-
- String id = "random-non-existing-id";
- try {
- boolean result = api.deleteServer(id);
- assertRequestHasCommonProperties(server.takeRequest());
- assertFalse(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiLiveTest.java
deleted file mode 100644
index fa7eea0..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiLiveTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.jclouds.profitbricks.domain.Storage;
-import org.testng.annotations.Test;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.FluentIterable;
-
-import org.jclouds.util.Predicates2;
-
-@Test(groups = "live", testName = "SnapshotApiLiveTest")
-public class SnapshotApiLiveTest extends BaseProfitBricksLiveTest {
-
- private DataCenter dataCenter;
- private Storage storage;
-
- private String createdSnapshotId;
-
- @BeforeClass
- public void setupTest() {
- dataCenter = findOrCreateDataCenter("snapshotApiLiveTest-" + System.currentTimeMillis());
- storage = FluentIterable.from(dataCenter.storages()).firstMatch(new Predicate<Storage>() {
-
- @Override
- public boolean apply(Storage input) {
- return input.state() == ProvisioningState.AVAILABLE
- && input.size() <= 10f;
- }
- }).or(new Supplier<Storage>() {
-
- @Override
- public Storage get() {
- StorageApi storageApi = api.storageApi();
- String name = String.format("server-%d", dataCenter.servers().size());
- String createdStorageId = storageApi.createStorage(
- Storage.Request.creatingBuilder()
- .dataCenterId(dataCenter.id())
- .name(name)
- .size(2f)
- .build()
- );
- assertDataCenterAvailable(dataCenter);
-
- return storageApi.getStorage(createdStorageId);
- }
- });
- }
-
- @Test
- public void testCreateSnapshot() {
- assertDataCenterAvailable(dataCenter);
- Snapshot snapshot = api.snapshotApi().createSnapshot(
- Snapshot.Request.creatingBuilder()
- .storageId(storage.id())
- .description("my description")
- .name("test snapshot")
- .build());
-
- assertNotNull(snapshot);
- assertSnapshotAvailable(snapshot.id());
-
- createdSnapshotId = snapshot.id();
- }
-
- @Test(dependsOnMethods = "testCreateSnapshot")
- public void testGetAllSnapshots() {
- List<Snapshot> snapshots = api.snapshotApi().getAllSnapshots();
-
- assertNotNull(snapshots);
- assertTrue(snapshots.size() > 0);
- }
-
- @Test(dependsOnMethods = "testCreateSnapshot")
- public void testGetSnapshot() {
- Snapshot snapshot = api.snapshotApi().getSnapshot(createdSnapshotId);
-
- assertNotNull(snapshot);
- assertEquals(snapshot.id(), createdSnapshotId);
- }
-
- @Test(dependsOnMethods = "testGetSnapshot")
- public void testUpdateSnapshot() {
- assertSnapshotAvailable(createdSnapshotId);
- String newName = "new name";
- String newDescription = "new description";
-
- String requestId = api.snapshotApi().updateSnapshot(
- Snapshot.Request.updatingBuilder()
- .id(createdSnapshotId)
- .description(newDescription)
- .name(newName)
- .bootable(true)
- .osType(OsType.LINUX)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(true)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .isRamHotPlug(true)
- .isRamHotUnPlug(true)
- .build());
- assertNotNull(requestId);
- }
-
- @Test(dependsOnMethods = "testUpdateSnapshot")
- public void testRollbackSnapshot() {
- assertSnapshotAvailable(createdSnapshotId);
- String requestid = api.snapshotApi().rollbackSnapshot(
- Snapshot.Request.createRollbackPayload(createdSnapshotId, storage.id()));
- assertNotNull(requestid);
- }
-
- @Test(dependsOnMethods = "testRollbackSnapshot", alwaysRun = true)
- public void testDeleteSnapshot() {
- assertSnapshotAvailable(createdSnapshotId);
- // Newly created snapshots doesn't seem to reflect in the API right away,
- // so we need to persistently try to delete (to clean up resources as well)
- Predicate<String> persistentDelete = Predicates2.retry(new Predicate<String>() {
-
- @Override
- public boolean apply(String input) {
- try {
- return api.snapshotApi().deleteSnapshot(input);
- } catch (Exception ex) {
- return false;
- }
- }
- }, 120L, 5L, 10L, TimeUnit.SECONDS);
- assertTrue(persistentDelete.apply(createdSnapshotId), "Created snapshot wasn't deleted");
- }
-
- @AfterClass(alwaysRun = true)
- public void cleanUp() {
- destroyDataCenter(dataCenter);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiMockTest.java
deleted file mode 100644
index 9574e76..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiMockTest.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * 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.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
-import org.testng.annotations.Test;
-
-import java.util.List;
-import static org.jclouds.profitbricks.internal.BaseProfitBricksMockTest.mockWebServer;
-import org.testng.Assert;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-/**
- * Mock tests for the {@link org.jclouds.profitbricks.features.DataCenterApi} class
- */
-@Test(groups = "unit", testName = "SnapshotApiMockTest")
-public class SnapshotApiMockTest extends BaseProfitBricksMockTest {
-
- @Test
- public void testGetAllSnapshots() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/snapshot/snapshots.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- SnapshotApi api = pbApi.snapshotApi();
-
- try {
- List<Snapshot> snapshots = api.getAllSnapshots();
- assertRequestHasCommonProperties(server.takeRequest(), "<ws:getAllSnapshots/>");
- assertNotNull(snapshots);
- assertEquals(snapshots.size(), 2);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetAllSnapshotsReturning404() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- SnapshotApi api = pbApi.snapshotApi();
-
- try {
- List<Snapshot> snapshots = api.getAllSnapshots();
- assertRequestHasCommonProperties(server.takeRequest());
- assertTrue(snapshots.isEmpty());
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetSnapshot() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/snapshot/snapshot.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- SnapshotApi api = pbApi.snapshotApi();
-
- String id = "qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh";
-
- String content = "<ws:getSnapshot><snapshotId>" + id + "</snapshotId></ws:getSnapshot>";
-
- try {
- Snapshot snapshot = api.getSnapshot(id);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(snapshot);
- assertEquals(snapshot.id(), id);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetNonExistingSnapshot() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- SnapshotApi api = pbApi.snapshotApi();
-
- String id = "random-non-existing-id";
- try {
- Snapshot snapshot = api.getSnapshot(id);
- assertRequestHasCommonProperties(server.takeRequest());
- assertNull(snapshot);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testCreateSnapshot() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/snapshot/snapshot-create.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- SnapshotApi api = pbApi.snapshotApi();
-
- String storageId = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
-
- String content = "<ws:createSnapshot>"
- + "<request>"
- + "<storageId>" + storageId + "</storageId>"
- + "<description>description</description>"
- + "<snapshotName>snapshot-name</snapshotName>"
- + "</request>"
- + "</ws:createSnapshot>";
-
- try {
- Snapshot snapshot = api.createSnapshot(
- Snapshot.Request.creatingBuilder()
- .storageId(storageId)
- .description("description")
- .name("snapshot-name")
- .build());
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(snapshot.id());
- assertEquals(snapshot.id(), "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
-
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testUpdateSnapshot() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/snapshot/snapshot-update.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- SnapshotApi api = pbApi.snapshotApi();
-
- String snapshotId = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
-
- String content = "<ws:updateSnapshot>"
- + "<request>"
- + "<snapshotId>" + snapshotId + "</snapshotId>"
- + "<description>description</description>"
- + "<snapshotName>snapshot-name</snapshotName>"
- + "<bootable>false</bootable>"
- + "<osType>LINUX</osType>"
- + "<cpuHotPlug>false</cpuHotPlug>"
- + "<cpuHotUnPlug>false</cpuHotUnPlug>"
- + "<ramHotPlug>false</ramHotPlug>"
- + "<ramHotUnPlug>false</ramHotUnPlug>"
- + "<nicHotPlug>false</nicHotPlug>"
- + "<nicHotUnPlug>false</nicHotUnPlug>"
- + "<discVirtioHotPlug>false</discVirtioHotPlug>"
- + "<discVirtioHotUnPlug>false</discVirtioHotUnPlug>"
- + "</request>"
- + "</ws:updateSnapshot>";
-
- try {
- String requestId = api.updateSnapshot(Snapshot.Request.updatingBuilder()
- .id(snapshotId)
- .description("description")
- .name("snapshot-name")
- .bootable(false)
- .osType(OsType.LINUX)
- .isCpuHotPlug(false)
- .isCpuHotUnPlug(false)
- .isDiscVirtioHotPlug(false)
- .isDiscVirtioHotUnPlug(false)
- .isNicHotPlug(false)
- .isNicHotUnPlug(false)
- .isRamHotPlug(false)
- .isRamHotUnPlug(false)
- .build());
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(requestId);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDeleteSnapshot() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/snapshot/snapshot-delete.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- SnapshotApi api = pbApi.snapshotApi();
-
- String snapshotId = "qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh";
- String content = "<ws:deleteSnapshot><snapshotId>" + snapshotId + "</snapshotId></ws:deleteSnapshot>";
-
- try {
- boolean result = api.deleteSnapshot(snapshotId);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertTrue(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDeleteNonExistingSnapshot() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- SnapshotApi api = pbApi.snapshotApi();
-
- String id = "random-non-existing-id";
- try {
- boolean result = api.deleteSnapshot(id);
- assertRequestHasCommonProperties(server.takeRequest());
- Assert.assertFalse(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testRollbackSnapshot() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/snapshot/snapshot-rollback.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- SnapshotApi api = pbApi.snapshotApi();
-
- String snapshotId = "qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh";
- String storageId = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
-
- String content = "<ws:rollbackSnapshot><request><snapshotId>" + snapshotId + "</snapshotId><storageId>" + storageId + "</storageId></request></ws:rollbackSnapshot>";
- try {
- String result = api.rollbackSnapshot(Snapshot.Request.createRollbackPayload(snapshotId, storageId));
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/StorageApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/StorageApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/StorageApiLiveTest.java
deleted file mode 100644
index cdaac80..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/StorageApiLiveTest.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Server;
-import org.jclouds.profitbricks.domain.Storage;
-import org.jclouds.rest.InsufficientResourcesException;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeClass;
-
-@Test(groups = "live", testName = "StorageApiLiveTest")
-public class StorageApiLiveTest extends BaseProfitBricksLiveTest {
-
- private DataCenter dataCenter;
- private Server server;
-
- private String createdStorageId;
-
- @BeforeClass
- public void setupTest() {
- dataCenter = findOrCreateDataCenter("storageApiLiveTest" + System.currentTimeMillis());
- server = findOrCreateServer(dataCenter);
- }
-
- @Test(expectedExceptions = InsufficientResourcesException.class)
- public void testUberStorage() {
- api.storageApi().createStorage(
- Storage.Request.creatingBuilder()
- .dataCenterId(dataCenter.id())
- .name("Uber Storage")
- .size(9999999f)
- .build());
- }
-
- @Test
- public void testCreateStorage() {
- assertDataCenterAvailable(dataCenter);
- String storageId = api.storageApi().createStorage(
- Storage.Request.creatingBuilder()
- .dataCenterId(dataCenter.id())
- .name("hdd-1")
- .size(2f)
- .build());
-
- assertNotNull(storageId);
- assertDataCenterAvailable(dataCenter);
-
- createdStorageId = storageId;
- }
-
- @Test(dependsOnMethods = "testCreateStorage")
- public void testGetStorage() {
- Storage storage = api.storageApi().getStorage(createdStorageId);
-
- assertNotNull(storage);
- assertEquals(storage.id(), createdStorageId);
- }
-
- @Test(dependsOnMethods = "testCreateStorage")
- public void testGetAllStorages() {
- List<Storage> storages = api.storageApi().getAllStorages();
-
- assertNotNull(storages);
- assertFalse(storages.isEmpty());
- }
-
- @Test(dependsOnMethods = "testCreateStorage")
- public void testUpdateStorage() {
- assertDataCenterAvailable(dataCenter);
- String requestId = api.storageApi().updateStorage(
- Storage.Request.updatingBuilder()
- .id(createdStorageId)
- .name("hdd-2")
- .size(5f)
- .build());
-
- assertNotNull(requestId);
- assertDataCenterAvailable(dataCenter);
-
- Storage storage = api.storageApi().getStorage(createdStorageId);
- assertEquals(storage.size(), 5f);
- assertEquals(storage.name(), "hdd-2");
- }
-
- @Test(dependsOnMethods = "testUpdateStorage")
- public void testConnectStorage() {
- assertDataCenterAvailable(dataCenter);
- String requestId = api.storageApi().connectStorageToServer(
- Storage.Request.connectingBuilder()
- .storageId(createdStorageId)
- .serverId(server.id())
- .build()
- );
-
- assertNotNull(requestId);
- assertDataCenterAvailable(dataCenter);
-
- Storage storage = api.storageApi().getStorage(createdStorageId);
- assertTrue(storage.serverIds().contains(server.id()));
- }
-
- @Test(dependsOnMethods = "testConnectStorage")
- public void testDisconnectStorage() {
- assertDataCenterAvailable(dataCenter);
- String requestId = api.storageApi()
- .disconnectStorageFromServer(createdStorageId, server.id());
-
- assertNotNull(requestId);
- assertDataCenterAvailable(dataCenter);
-
- Storage storage = api.storageApi().getStorage(createdStorageId);
- assertFalse(storage.serverIds().contains(server.id()));
- }
-
- @Test(dependsOnMethods = "testDisconnectStorage")
- public void testDeleteStorage() {
- assertDataCenterAvailable(dataCenter);
- boolean result = api.storageApi().deleteStorage(createdStorageId);
- assertTrue(result, "Created test storage was not deleted");
- }
-
- @AfterClass(alwaysRun = true)
- public void cleanUp() {
- destroyDataCenter(dataCenter);
- }
-}
[05/11] jclouds-labs git commit: Remove ProfitBricks
Posted by de...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/compute/config/StatusPredicateTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/compute/config/StatusPredicateTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/compute/config/StatusPredicateTest.java
deleted file mode 100644
index 9c2b228..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/compute/config/StatusPredicateTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.compute.config;
-
-import static org.jclouds.profitbricks.internal.BaseProfitBricksMockTest.mockWebServer;
-import static org.testng.Assert.assertEquals;
-
-import java.util.concurrent.TimeUnit;
-
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.compute.config.ProfitBricksComputeServiceContextModule.DataCenterProvisioningStatePredicate;
-import org.jclouds.profitbricks.compute.config.ProfitBricksComputeServiceContextModule.ServerStatusPredicate;
-import org.jclouds.profitbricks.compute.config.ProfitBricksComputeServiceContextModule.SnapshotProvisioningStatePredicate;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.domain.Server;
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
-import org.jclouds.util.Predicates2;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-import com.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-
-
-/**
- * Test class for {@link DataCenterProvisioningStatePredicate} and {@link ServerStatusPredicate}
- */
-@Test(groups = "unit", testName = "ProvisioningStatusPollingPredicateTest")
-public class StatusPredicateTest extends BaseProfitBricksMockTest {
-
- @Test
- public void testDataCenterPredicate() throws Exception {
- MockWebServer server = mockWebServer();
-
- byte[] payloadInProcess = payloadFromResource("/datacenter/datacenter-state-inprocess.xml");
- byte[] payloadAvailable = payloadFromResource("/datacenter/datacenter-state.xml");
-
- // wait 3 times
- server.enqueue(new MockResponse().setBody(payloadInProcess));
- server.enqueue(new MockResponse().setBody(payloadInProcess));
- server.enqueue(new MockResponse().setBody(payloadInProcess));
- server.enqueue(new MockResponse().setBody(payloadAvailable));
-
- server.enqueue(new MockResponse().setBody(payloadAvailable));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-
- Predicate<String> waitUntilAvailable = Predicates2.retry(
- new DataCenterProvisioningStatePredicate(pbApi, ProvisioningState.AVAILABLE),
- 30l, 1l, TimeUnit.SECONDS);
-
- String id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
- try {
- waitUntilAvailable.apply(id);
- ProvisioningState finalState = pbApi.dataCenterApi().getDataCenterState(id);
- assertRequestHasCommonProperties(server.takeRequest());
- assertEquals(finalState, ProvisioningState.AVAILABLE);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testServerPredicate() throws Exception {
- MockWebServer server = mockWebServer();
-
- byte[] payloadInProcess = payloadFromResource("/server/server-state-inprocess.xml");
- byte[] payloadAvailable = payloadFromResource("/server/server.xml");
-
- // wait 3 times
- server.enqueue(new MockResponse().setBody(payloadInProcess));
- server.enqueue(new MockResponse().setBody(payloadInProcess));
- server.enqueue(new MockResponse().setBody(payloadInProcess));
- server.enqueue(new MockResponse().setBody(payloadAvailable));
-
- server.enqueue(new MockResponse().setBody(payloadAvailable));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-
- Predicate<String> waitUntilAvailable = Predicates2.retry(
- new ServerStatusPredicate(pbApi, Server.Status.RUNNING),
- 30l, 1l, TimeUnit.SECONDS);
-
- String id = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
- try {
- waitUntilAvailable.apply(id);
- Server remoteServer = pbApi.serverApi().getServer(id);
- assertEquals(remoteServer.status(), Server.Status.RUNNING);
- assertRequestHasCommonProperties(server.takeRequest());
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testSnapshotPredicate() throws Exception {
- MockWebServer server = mockWebServer();
-
- byte[] payloadInProcess = payloadFromResource("/snapshot/snapshot-state-inprocess.xml");
- byte[] payloadAvailable = payloadFromResource("/snapshot/snapshot.xml");
-
- // wait 3 times
- server.enqueue(new MockResponse().setBody(payloadInProcess));
- server.enqueue(new MockResponse().setBody(payloadInProcess));
- server.enqueue(new MockResponse().setBody(payloadInProcess));
- server.enqueue(new MockResponse().setBody(payloadAvailable));
-
- server.enqueue(new MockResponse().setBody(payloadAvailable));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-
- Predicate<String> waitUntilAvailable = Predicates2.retry(
- new SnapshotProvisioningStatePredicate(pbApi, ProvisioningState.AVAILABLE),
- 30l, 1l, TimeUnit.SECONDS);
-
- String id = "qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh";
- try {
- waitUntilAvailable.apply(id);
- Snapshot snapshot = pbApi.snapshotApi().getSnapshot(id);
- assertEquals(snapshot.state(), ProvisioningState.AVAILABLE);
- assertRequestHasCommonProperties(server.takeRequest());
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/ProvisionableToImageTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/ProvisionableToImageTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/ProvisionableToImageTest.java
deleted file mode 100644
index ddecc83..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/ProvisionableToImageTest.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * 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.compute.function;
-
-import static org.jclouds.profitbricks.domain.Location.US_LAS;
-import static org.testng.Assert.assertEquals;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Set;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.ImageBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-@Test(groups = "unit", testName = "ProvisionableToImageTest")
-public class ProvisionableToImageTest {
-
- private ProvisionableToImage fnImage;
-
- private final Location location = new LocationBuilder().id("us/las").description("us/las").scope(LocationScope.ZONE)
- .parent(new LocationBuilder().id("us").description("us").scope(LocationScope.REGION).build()).build();
-
- @BeforeTest
- public void setup() {
- this.fnImage = new ProvisionableToImage(Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.of(location)));
- }
-
- @Test
- public void testImageToImage() {
- org.jclouds.profitbricks.domain.Image image
- = org.jclouds.profitbricks.domain.Image.builder()
- .isBootable(true)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(false)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .id("5ad99c9e-9166-11e4-9d74-52540066fee9")
- .name("Ubuntu-14.04-LTS-server-2015-01-01")
- .size(2048f)
- .type(org.jclouds.profitbricks.domain.Image.Type.HDD)
- .location(US_LAS)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .osType(OsType.LINUX)
- .isPublic(true)
- .isRamHotPlug(true)
- .isRamHotUnPlug(false)
- .isWriteable(true)
- .build();
-
- Image actual = fnImage.apply(image);
-
- Image expected = new ImageBuilder()
- .ids(image.id())
- .name(image.name())
- .location(location)
- .status(Image.Status.AVAILABLE)
- .operatingSystem(OperatingSystem.builder()
- .description("UBUNTU")
- .family(OsFamily.UBUNTU)
- .version("14.04")
- .is64Bit(false)
- .build())
- .userMetadata(ImmutableMap.of("provisionableType", "image"))
- .build();
-
- assertEquals(actual, expected);
- }
-
- @Test
- public void testImageDescriptionParsing() {
- org.jclouds.profitbricks.domain.Image image1
- = org.jclouds.profitbricks.domain.Image.builder()
- .id("f4742db0-9160-11e4-9d74-52540066fee9")
- .name("Fedora-19-server-2015-01-01")
- .size(2048f)
- .type(org.jclouds.profitbricks.domain.Image.Type.HDD)
- .location(US_LAS)
- .osType(OsType.LINUX)
- .build();
-
- Image actual1 = fnImage.apply(image1);
-
- Image expected1 = new ImageBuilder()
- .ids(image1.id())
- .name(image1.name())
- .location(location)
- .status(Image.Status.AVAILABLE)
- .operatingSystem(OperatingSystem.builder()
- .description("FEDORA")
- .family(OsFamily.FEDORA)
- .version("7")
- .is64Bit(true)
- .build())
- .userMetadata(ImmutableMap.of("provisionableType", "image"))
- .build();
-
- assertEquals(actual1, expected1);
-
- org.jclouds.profitbricks.domain.Image image2
- = org.jclouds.profitbricks.domain.Image.builder()
- .id("457bf707-d5d1-11e3-8b4f-52540066fee9")
- .name("clearos-community-6.5.0-x86_64.iso")
- .size(2048f)
- .type(org.jclouds.profitbricks.domain.Image.Type.CDROM)
- .location(US_LAS)
- .osType(OsType.LINUX)
- .build();
-
- Image actual2 = fnImage.apply(image2);
-
- Image expected2 = new ImageBuilder()
- .ids(image2.id())
- .name(image2.name())
- .location(location)
- .status(Image.Status.AVAILABLE)
- .operatingSystem(OperatingSystem.builder()
- .description("UNRECOGNIZED")
- .family(OsFamily.UNRECOGNIZED)
- .version("6.5.0")
- .is64Bit(true)
- .build())
- .userMetadata(ImmutableMap.of("provisionableType", "image"))
- .build();
-
- assertEquals(actual2, expected2);
-
- org.jclouds.profitbricks.domain.Image image3
- = org.jclouds.profitbricks.domain.Image.builder()
- .id("e54af701-53b8-11e3-8f17-52540066fee9")
- .name("windows-2008-r2-server-setup.iso")
- .size(2048f)
- .type(org.jclouds.profitbricks.domain.Image.Type.CDROM)
- .location(US_LAS)
- .osType(OsType.WINDOWS)
- .build();
-
- Image actual3 = fnImage.apply(image3);
-
- Image expected3 = new ImageBuilder()
- .ids(image3.id())
- .name(image3.name())
- .location(location)
- .status(Image.Status.AVAILABLE)
- .operatingSystem(OperatingSystem.builder()
- .description("WINDOWS")
- .family(OsFamily.WINDOWS)
- .version("2008")
- .is64Bit(false)
- .build())
- .userMetadata(ImmutableMap.of("provisionableType", "image"))
- .build();
-
- assertEquals(actual3, expected3);
-
- }
-
- @Test
- public void testSnapshotToImage() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2015, 4, 13);
- Date date = calendar.getTime();
-
- Snapshot snapshot1 = Snapshot.builder()
- .isBootable(true)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(false)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .id("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
- .name("placeholder-snapshot-04/13/2015")
- .description("Created from \"placeholder\" in Data Center \"sbx-computeservice\"")
- .size(2048f)
- .location(US_LAS)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .osType(OsType.LINUX)
- .isRamHotPlug(true)
- .isRamHotUnPlug(false)
- .creationTime(date)
- .lastModificationTime(new Date())
- .state(ProvisioningState.AVAILABLE)
- .build();
-
- Image actual1 = fnImage.apply(snapshot1);
-
- Image expected1 = new ImageBuilder()
- .ids(snapshot1.id())
- .name(snapshot1.name())
- .location(location)
- .status(Image.Status.AVAILABLE)
- .operatingSystem(OperatingSystem.builder()
- .description(snapshot1.description())
- .family(OsFamily.LINUX)
- .is64Bit(true)
- .build())
- .userMetadata(ImmutableMap.of("provisionableType", "snapshot"))
- .build();
-
- assertEquals(actual1, expected1);
-
- Snapshot snapshot2 = Snapshot.builder()
- .isBootable(true)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(false)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .id("d80bf9c0-ce6e-4283-9ea4-2906635f6137")
- .name("jclouds-ubuntu14.10-template")
- .description("Created from \"jclouds-ubuntu14.10 Storage\" in Data Center \"jclouds-computeservice\"")
- .size(10240f)
- .location(US_LAS)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .osType(OsType.LINUX)
- .isRamHotPlug(true)
- .isRamHotUnPlug(false)
- .creationTime(date)
- .lastModificationTime(new Date())
- .state(ProvisioningState.INPROCESS)
- .build();
-
- Image actual2 = fnImage.apply(snapshot2);
-
- Image expected2 = new ImageBuilder()
- .ids(snapshot2.id())
- .name(snapshot2.name())
- .location(location)
- .status(Image.Status.PENDING)
- .operatingSystem(OperatingSystem.builder()
- .description("ubuntu")
- .family(OsFamily.UBUNTU)
- .is64Bit(true)
- .version("00.00")
- .build())
- .userMetadata(ImmutableMap.of("provisionableType", "snapshot"))
- .build();
-
- assertEquals(actual2, expected2);
- assertEquals(actual2.getOperatingSystem(), expected2.getOperatingSystem());
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/ServerToNodeMetadataTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/ServerToNodeMetadataTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/ServerToNodeMetadataTest.java
deleted file mode 100644
index 60f43ec..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/ServerToNodeMetadataTest.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * 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.compute.function;
-
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.jclouds.profitbricks.domain.Location.DE_FRA;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.Set;
-
-import org.easymock.EasyMock;
-import org.jclouds.compute.domain.HardwareBuilder;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.domain.Processor;
-import org.jclouds.compute.domain.Volume;
-import org.jclouds.compute.domain.VolumeBuilder;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.ProfitBricksApiMetadata;
-import org.jclouds.profitbricks.domain.AvailabilityZone;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.domain.Server;
-import org.jclouds.profitbricks.domain.Storage;
-import org.jclouds.profitbricks.features.DataCenterApi;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.name.Names;
-
-@Test(groups = "unit", testName = "ServerToNodeMetadataTest")
-public class ServerToNodeMetadataTest {
-
- private ServerToNodeMetadata fnNodeMetadata;
-
- private ProfitBricksApi api;
-
- private DataCenterApi dataCenterApi;
-
- @BeforeMethod
- public void setup() {
- Supplier<Set<? extends Location>> locationsSupply = new Supplier<Set<? extends Location>>() {
- @Override
- public Set<? extends Location> get() {
- return ImmutableSet.of(
- new LocationBuilder()
- .id("de/fra")
- .description("de/fra")
- .scope(LocationScope.ZONE)
- .parent(new LocationBuilder()
- .id("de")
- .description("de")
- .scope(LocationScope.REGION)
- .build())
- .build());
- }
- };
-
- GroupNamingConvention.Factory namingConvention = Guice.createInjector(new AbstractModule() {
- @Override
- protected void configure() {
- Names.bindProperties(binder(), new ProfitBricksApiMetadata().getDefaultProperties());
- }
- }).getInstance(GroupNamingConvention.Factory.class);
-
- dataCenterApi = EasyMock.createMock(DataCenterApi.class);
- api = EasyMock.createMock(ProfitBricksApi.class);
-
- expect(dataCenterApi.getDataCenter("mock")).andReturn(
- DataCenter.builder().id("mock").version(10).location(DE_FRA).build());
- expect(api.dataCenterApi()).andReturn(dataCenterApi);
-
- replay(dataCenterApi, api);
-
- this.fnNodeMetadata = new ServerToNodeMetadata(new StorageToVolume(), locationsSupply, api, namingConvention);
- }
-
- @AfterMethod
- public void tearDown() {
- verify(api, dataCenterApi);
- }
-
- @Test
- public void testServerToNodeMetadata() {
- Server server = Server.builder()
- .dataCenter(DataCenter.builder()
- .id("mock")
- .version(10)
- .location(org.jclouds.profitbricks.domain.Location.DE_FRA)
- .build())
- .id("qwertyui-qwer-qwer-qwer-qwertyyuiiop")
- .name("mock-facebook-node")
- .cores(4)
- .ram(4096)
- .hasInternetAccess(true)
- .state(ProvisioningState.AVAILABLE)
- .status(Server.Status.RUNNING)
- .osType(OsType.LINUX)
- .availabilityZone(AvailabilityZone.AUTO)
- .isCpuHotPlug(true)
- .isRamHotPlug(true)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .storages(ImmutableList.<Storage>of(
- Storage.builder()
- .bootDevice(true)
- .busType(Storage.BusType.VIRTIO)
- .deviceNumber(1)
- .size(40f)
- .id("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
- .name("facebook-storage")
- .build()
- )
- )
- .nics(ImmutableList.<Nic>of(
- Nic.builder()
- .id("qwqwqwqw-wewe-erer-rtrt-tytytytytyty")
- .lanId(1)
- .dataCenterId("12345678-abcd-efgh-ijkl-987654321000")
- .internetAccess(true)
- .serverId("qwertyui-qwer-qwer-qwer-qwertyyuiiop")
- .macAddress("02:01:09:cd:f0:b0")
- .ips( ImmutableList.<String>of("173.252.120.6"))
- .build()
- )
- )
- .build();
-
- NodeMetadata expected = fnNodeMetadata.apply(server);
- assertNotNull(expected);
-
- NodeMetadata actual = new NodeMetadataBuilder()
- .group("mock")
- .ids(server.id())
- .name(server.name())
- .backendStatus("AVAILABLE")
- .status(NodeMetadata.Status.RUNNING)
- .hardware(new HardwareBuilder()
- .ids("cpu=4,ram=4096,disk=40")
- .name("cpu=4,ram=4096,disk=40")
- .ram(server.ram())
- .processor(new Processor(server.cores(), 1d))
- .hypervisor("kvm")
- .volume(new VolumeBuilder()
- .bootDevice(true)
- .size(40f)
- .id("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
- .durable(true)
- .type(Volume.Type.LOCAL)
- .build())
- .build())
- .operatingSystem(new OperatingSystem.Builder()
- .description(OsFamily.LINUX.value())
- .family(OsFamily.LINUX)
- .build())
- .location(new LocationBuilder()
- .id("de/fra")
- .description("de/fra")
- .scope(LocationScope.ZONE)
- .parent(new LocationBuilder()
- .id("de")
- .description("de")
- .scope(LocationScope.REGION)
- .build())
- .build())
- .publicAddresses(ImmutableList.<String>of("173.252.120.6"))
- .build();
-
- assertEquals(actual, expected);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/StorageToVolumeTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/StorageToVolumeTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/StorageToVolumeTest.java
deleted file mode 100644
index 8a782e7..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/StorageToVolumeTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.compute.function;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.compute.domain.Volume;
-import org.jclouds.compute.domain.VolumeBuilder;
-import org.jclouds.profitbricks.domain.Storage;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "StorageToVolumeTest")
-public class StorageToVolumeTest {
-
- private StorageToVolume fnVolume;
-
- @BeforeTest
- public void setup() {
- this.fnVolume = new StorageToVolume();
- }
-
- @Test
- public void testStorageToVolume() {
- Storage storage = Storage.builder()
- .id("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
- .size(40)
- .name("hdd-1")
- .busType(Storage.BusType.VIRTIO)
- .bootDevice(true)
- .deviceNumber(1)
- .build();
-
- Volume actual = fnVolume.apply(storage);
-
- Volume expected = new VolumeBuilder()
- .id(storage.id())
- .size(40f)
- .bootDevice(true)
- .device("1")
- .type(Volume.Type.LOCAL)
- .durable(true)
- .build();
-
- assertEquals(actual, expected);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/domain/FirewallRuleBuilderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/domain/FirewallRuleBuilderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/domain/FirewallRuleBuilderTest.java
deleted file mode 100644
index 6f43604..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/domain/FirewallRuleBuilderTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "FirewallRuleBuilderTest")
-public class FirewallRuleBuilderTest {
-
- private final String _name = "rule-name";
- private final Integer _portRangeEnd = 45678;
- private final Integer _portRangeStart = 12345;
- private final Firewall.Protocol _protocol = Firewall.Protocol.TCP;
- private final String _sourceIp = "192.168.0.1";
- private final String _sourceMac = "aa:bb:cc:dd:ee:ff";
- private final String _targetIp = "192.168.0.2";
-
- private final Integer _icmpType = 2;
- private final Integer _icmpCode = 24;
-
- @Test
- public void testAutoValueFirewallRulePropertiesSettingCorrectly() {
- Firewall.Rule actual = Firewall.Rule.builder()
- .name(_name)
- .portRangeEnd(_portRangeEnd)
- .portRangeStart(_portRangeStart)
- .protocol(_protocol)
- .sourceIp(_sourceIp)
- .sourceMac(_sourceMac)
- .targetIp(_targetIp)
- .build();
-
- assertEquals(actual.name(), _name);
- assertEquals(actual.portRangeEnd(), _portRangeEnd);
- assertEquals(actual.portRangeStart(), _portRangeStart);
- assertEquals(actual.protocol(), _protocol);
- assertEquals(actual.sourceIp(), _sourceIp);
- assertEquals(actual.sourceMac(), _sourceMac);
- assertEquals(actual.targetIp(), _targetIp);
- }
-
- @Test
- public void testAutoValueFirewallRuleWithIcmpPropertiesSettingCorrectly() {
- Firewall.Rule actual = Firewall.Rule.builder()
- .name(_name)
- .icmpCode(_icmpCode)
- .icmpType(_icmpType)
- .protocol(Firewall.Protocol.ICMP)
- .sourceIp(_sourceIp)
- .sourceMac(_sourceMac)
- .targetIp(_targetIp)
- .build();
-
- assertEquals(actual.name(), _name);
- assertNull(actual.portRangeEnd());
- assertNull(actual.portRangeStart());
- assertEquals(actual.protocol(), Firewall.Protocol.ICMP);
- assertEquals(actual.sourceIp(), _sourceIp);
- assertEquals(actual.sourceMac(), _sourceMac);
- assertEquals(actual.targetIp(), _targetIp);
- assertEquals(actual.icmpCode(), _icmpCode);
- assertEquals(actual.icmpType(), _icmpType);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/domain/ServerBuilderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/domain/ServerBuilderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/domain/ServerBuilderTest.java
deleted file mode 100644
index 6cad856..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/domain/ServerBuilderTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * 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 java.util.Date;
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ServerBuilderTest")
-public class ServerBuilderTest {
-
- private final Boolean _isCpuHotPlug = true;
- private final Boolean _isRamHotPlug = false;
- private final Boolean _isNicHotPlug = true;
- private final Boolean _isNicHotUnPlug = false;
- private final Boolean _isDiscVirtioHotPlug = true;
- private final Boolean _isDiscVirtioHotUnPlug = false;
- private final Integer _cores = 8;
- private final Integer _ram = 8 * 1024;
- private final String _id = "some-random-server-id";
- private final String _name = "jclouds-node";
- private final Boolean _hasInternetAccess = true;
- private final ProvisioningState _state = ProvisioningState.INACTIVE;
- private final Server.Status _status = Server.Status.SHUTOFF;
- private final OsType _osType = OsType.LINUX;
- private final AvailabilityZone _availabilityZone = AvailabilityZone.ZONE_1;
- private final Date _creationTime = new Date();
- private final Date _lastModificationTime = new Date();
-
- private final Integer _lanId = 5;
- private final String _dataCenterId = "some-random-datacenter-id";
- private final String _bootFromStorageId = "some-random-storage-id";
- private final String _bootFromImageId = "some-random-image-id";
-
- @Test
- public void testAutoValueServerPropertiesSettingCorrectly() {
- Server actual = Server.builder()
- .availabilityZone(_availabilityZone)
- .creationTime(_creationTime)
- .cores(_cores)
- .hasInternetAccess(_hasInternetAccess)
- .id(_id)
- .name(_name)
- .isCpuHotPlug(_isCpuHotPlug)
- .isDiscVirtioHotPlug(_isDiscVirtioHotPlug)
- .isDiscVirtioHotUnPlug(_isDiscVirtioHotUnPlug)
- .isNicHotPlug(_isNicHotPlug)
- .isNicHotUnPlug(_isNicHotUnPlug)
- .isRamHotPlug(_isRamHotPlug)
- .lastModificationTime(_lastModificationTime)
- .ram(_ram)
- .osType(_osType)
- .state(_state)
- .status(_status)
- .build();
-
- assertEquals(actual.availabilityZone(), _availabilityZone);
- assertEquals(actual.cores(), _cores);
- assertEquals(actual.creationTime(), _creationTime);
- assertEquals(actual.hasInternetAccess(), _hasInternetAccess);
- assertEquals(actual.id(), _id);
- assertEquals(actual.name(), _name);
- assertEquals(actual.isCpuHotPlug(), _isCpuHotPlug);
- assertEquals(actual.isDiscVirtioHotPlug(), _isDiscVirtioHotPlug);
- assertEquals(actual.isDiscVirtioHotUnPlug(), _isDiscVirtioHotUnPlug);
- assertEquals(actual.isNicHotPlug(), _isNicHotPlug);
- assertEquals(actual.isNicHotUnPlug(), _isNicHotUnPlug);
- assertEquals(actual.isRamHotPlug(), _isRamHotPlug);
- assertEquals(actual.lastModificationTime(), _lastModificationTime);
- assertEquals(actual.ram(), _ram);
- assertEquals(actual.osType(), _osType);
- assertEquals(actual.state(), _state);
- }
-
- @Test
- public void testAutoValueServerRequestCreatePayloadPropertiesSettingCorrectly() {
- Server.Request.CreatePayload actual = Server.Request.creatingBuilder()
- .availabilityZone(_availabilityZone)
- .bootFromImageId(_bootFromImageId)
- .bootFromStorageId(_bootFromStorageId)
- .cores(_cores)
- .dataCenterId(_dataCenterId)
- .hasInternetAccess(_hasInternetAccess)
- .name(_name)
- .isCpuHotPlug(_isCpuHotPlug)
- .isDiscVirtioHotPlug(_isDiscVirtioHotPlug)
- .isDiscVirtioHotUnPlug(_isDiscVirtioHotUnPlug)
- .isNicHotPlug(_isNicHotPlug)
- .isNicHotUnPlug(_isNicHotUnPlug)
- .isRamHotPlug(_isRamHotPlug)
- .lanId(_lanId)
- .ram(_ram)
- .osType(_osType)
- .build();
-
- assertEquals(actual.availabilityZone(), _availabilityZone);
- assertEquals(actual.bootFromImageId(), _bootFromImageId);
- assertEquals(actual.bootFromStorageId(), _bootFromStorageId);
- assertEquals(actual.cores(), _cores.intValue());
- assertEquals(actual.dataCenterId(), _dataCenterId);
- assertEquals(actual.hasInternetAccess(), _hasInternetAccess);
- assertEquals(actual.name(), _name);
- assertEquals(actual.isCpuHotPlug(), _isCpuHotPlug);
- assertEquals(actual.isDiscVirtioHotPlug(), _isDiscVirtioHotPlug);
- assertEquals(actual.isDiscVirtioHotUnPlug(), _isDiscVirtioHotUnPlug);
- assertEquals(actual.isNicHotPlug(), _isNicHotPlug);
- assertEquals(actual.isNicHotUnPlug(), _isNicHotUnPlug);
- assertEquals(actual.isRamHotPlug(), _isRamHotPlug);
- assertEquals(actual.lanId(), _lanId);
- assertEquals(actual.ram(), _ram.intValue());
- assertEquals(actual.osType(), _osType);
- }
-
- @Test
- public void testAutoValueServerRequestUpdatePayloadPropertiesSettingCorrectly() {
- Server.Request.UpdatePayload actual = Server.Request.updatingBuilder()
- .availabilityZone(_availabilityZone)
- .bootFromImageId(_bootFromImageId)
- .bootFromStorageId(_bootFromStorageId)
- .cores(_cores)
- .name(_name)
- .id(_id)
- .isCpuHotPlug(_isCpuHotPlug)
- .isDiscVirtioHotPlug(_isDiscVirtioHotPlug)
- .isDiscVirtioHotUnPlug(_isDiscVirtioHotUnPlug)
- .isNicHotPlug(_isNicHotPlug)
- .isNicHotUnPlug(_isNicHotUnPlug)
- .isRamHotPlug(_isRamHotPlug)
- .ram(_ram)
- .osType(_osType)
- .build();
-
- assertEquals(actual.availabilityZone(), _availabilityZone);
- assertEquals(actual.bootFromImageId(), _bootFromImageId);
- assertEquals(actual.bootFromStorageId(), _bootFromStorageId);
- assertEquals(actual.cores(), _cores);
- assertEquals(actual.name(), _name);
- assertEquals(actual.id(), _id);
- assertEquals(actual.isCpuHotPlug(), _isCpuHotPlug);
- assertEquals(actual.isDiscVirtioHotPlug(), _isDiscVirtioHotPlug);
- assertEquals(actual.isDiscVirtioHotUnPlug(), _isDiscVirtioHotUnPlug);
- assertEquals(actual.isNicHotPlug(), _isNicHotPlug);
- assertEquals(actual.isNicHotUnPlug(), _isNicHotUnPlug);
- assertEquals(actual.isRamHotPlug(), _isRamHotPlug);
- assertEquals(actual.ram(), _ram);
- assertEquals(actual.osType(), _osType);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/DataCenterApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/DataCenterApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/DataCenterApiLiveTest.java
deleted file mode 100644
index 33a086c..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/DataCenterApiLiveTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", testName = "DataCenterApiLiveTest")
-public class DataCenterApiLiveTest extends BaseProfitBricksLiveTest {
-
- private String dcId;
-
- @Test
- public void testCreateDataCenter() {
- DataCenter dc = api.dataCenterApi().createDataCenter(
- DataCenter.Request.creatingPayload("JClouds", Location.DE_FKB)
- );
-
- assertNotNull(dc);
- assertDataCenterAvailable(dc);
-
- dcId = dc.id();
- }
-
- @Test(dependsOnMethods = "testCreateDataCenter")
- public void testGetDataCenter() {
- assertNotNull(dcId, "No available datacenter found.");
-
- DataCenter dataCenter = api.dataCenterApi().getDataCenter(dcId);
-
- assertNotNull(dataCenter);
- assertEquals(dataCenter.id(), dcId);
- }
-
- @Test(dependsOnMethods = "testCreateDataCenter")
- public void testGetAllDataCenters() {
- List<DataCenter> dataCenters = api.dataCenterApi().getAllDataCenters();
-
- assertNotNull(dataCenters);
- assertFalse(dataCenters.isEmpty(), "No datacenter found.");
- }
-
- @Test(dependsOnMethods = "testCreateDataCenter")
- public void testGetDataCenterState() {
- assertNotNull(dcId, "No available datacenter found.");
-
- ProvisioningState state = api.dataCenterApi().getDataCenterState(dcId);
-
- assertNotNull(state);
- }
-
- @Test(dependsOnMethods = "testGetDataCenter")
- public void testUpdateDataCenter() {
- assertNotNull(dcId, "No available datacenter found.");
-
- final String newName = "Apache";
- DataCenter dataCenter = api.dataCenterApi().updateDataCenter(
- DataCenter.Request.updatingPayload(dcId, newName)
- );
-
- assertNotNull(dataCenter);
- assertDataCenterAvailable(dataCenter);
-
- DataCenter fetchedDc = api.dataCenterApi().getDataCenter(dcId);
-
- assertNotNull(fetchedDc);
- assertEquals(newName, fetchedDc.name());
- }
-
- @Test(dependsOnMethods = "testUpdateDataCenter")
- public void testClearDataCenter() {
- DataCenter dataCenter = api.dataCenterApi().clearDataCenter(dcId);
-
- assertNotNull(dataCenter);
- }
-
- @Test
- public void testGetNonExistingDataCenter() {
- DataCenter dataCenter = api.dataCenterApi().getDataCenter("random-non-existing-id");
-
- assertNull(dataCenter);
- }
-
- @Test
- public void testDeleteNonExistingDataCenterMustReturnFalse() {
- boolean result = api.dataCenterApi().deleteDataCenter("random-non-existing-id");
-
- assertFalse(result);
- }
-
- @AfterClass(alwaysRun = true)
- public void testDeleteDataCenter() {
- boolean result = api.dataCenterApi().deleteDataCenter(dcId);
- assertTrue(result, "Created test data center was not deleted.");
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/DataCenterApiMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/DataCenterApiMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/DataCenterApiMockTest.java
deleted file mode 100644
index 262d34a..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/DataCenterApiMockTest.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
-import org.testng.annotations.Test;
-
-import com.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-
-/**
- * Mock tests for the {@link org.jclouds.profitbricks.features.DataCenterApi} class
- */
-@Test(groups = "unit", testName = "DataCenterApiMockTest")
-public class DataCenterApiMockTest extends BaseProfitBricksMockTest {
-
- @Test
- public void testGetAllDataCenters() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/datacenter/datacenters.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- DataCenterApi api = pbApi.dataCenterApi();
-
- try {
- List<DataCenter> dataCenters = api.getAllDataCenters();
- assertRequestHasCommonProperties(server.takeRequest(), "<ws:getAllDataCenters/>");
- assertNotNull(dataCenters);
- assertEquals(dataCenters.size(), 2);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetAllDataCentersReturning404() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- DataCenterApi api = pbApi.dataCenterApi();
-
- try {
- List<DataCenter> dataCenters = api.getAllDataCenters();
- assertRequestHasCommonProperties(server.takeRequest());
- assertTrue(dataCenters.isEmpty());
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetDataCenter() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/datacenter/datacenter.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- DataCenterApi api = pbApi.dataCenterApi();
-
- String id = "12345678-abcd-efgh-ijkl-987654321000";
- String content = "<ws:getDataCenter><dataCenterId>" + id + "</dataCenterId></ws:getDataCenter>";
- try {
- DataCenter dataCenter = api.getDataCenter(id);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(dataCenter);
- assertEquals(dataCenter.id(), id);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetNonExistingDataCenter() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- DataCenterApi api = pbApi.dataCenterApi();
-
- String id = "random-non-existing-id";
- try {
- DataCenter dataCenter = api.getDataCenter(id);
- assertRequestHasCommonProperties(server.takeRequest());
- assertNull(dataCenter);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetDataCenterState() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/datacenter/datacenter-state.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- DataCenterApi api = pbApi.dataCenterApi();
-
- String id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
- String content = "<ws:getDataCenterState><dataCenterId>" + id + "</dataCenterId></ws:getDataCenterState>";
- try {
- ProvisioningState state = api.getDataCenterState(id);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(state);
- assertEquals(state, ProvisioningState.AVAILABLE);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testCreateDataCenter() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/datacenter/datacenter-created.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- DataCenterApi api = pbApi.dataCenterApi();
-
- String content = "<ws:createDataCenter><request>"
- + "<dataCenterName>JClouds-DC</dataCenterName>"
- + "<location>de/fra</location>"
- + "</request></ws:createDataCenter>";
- try {
- DataCenter dataCenter = api.createDataCenter(
- DataCenter.Request.creatingPayload("JClouds-DC", Location.DE_FRA)
- );
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(dataCenter);
- assertEquals(dataCenter.id(), "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
- assertEquals(dataCenter.version(), 1);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testCreateDataCenterWithIllegalArguments() throws Exception {
- String[] names = {"JCl@ouds", "JC|ouds", "^clouds", ""};
- for (String name : names)
- try {
- DataCenter.Request.creatingPayload(name, Location.US_LAS);
- fail("Should have failed for name: ".concat(name));
- } catch (IllegalArgumentException ex) {
- // expected exception
- }
- }
-
- @Test
- public void testUpdateDataCenter() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/datacenter/datacenter-updated.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- DataCenterApi api = pbApi.dataCenterApi();
-
- String id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
- String newName = "Apache";
-
- String content = "<ws:updateDataCenter><request>"
- + "<dataCenterId>" + id + "</dataCenterId>"
- + "<dataCenterName>" + newName + "</dataCenterName>"
- + "</request></ws:updateDataCenter>";
- try {
- DataCenter dataCenter = api.updateDataCenter(
- DataCenter.Request.updatingPayload(id, newName)
- );
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(dataCenter);
- assertEquals(dataCenter.id(), id);
- assertEquals(dataCenter.version(), 2);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testClearDataCenter() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/datacenter/datacenter-cleared.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- DataCenterApi api = pbApi.dataCenterApi();
-
- String id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
-
- String content = "<ws:clearDataCenter><dataCenterId>" + id + "</dataCenterId></ws:clearDataCenter>";
- try {
- DataCenter dataCenter = api.clearDataCenter(id);
-
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(dataCenter);
- assertEquals(dataCenter.id(), id);
- assertEquals(dataCenter.version(), 3);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDeleteDataCenter() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/datacenter/datacenter-deleted.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- DataCenterApi api = pbApi.dataCenterApi();
-
- String id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
-
- String content = "<ws:deleteDataCenter><dataCenterId>" + id + "</dataCenterId></ws:deleteDataCenter>";
- try {
- boolean result = api.deleteDataCenter(id);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertTrue(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDeleteNonExistingDataCenter() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- DataCenterApi api = pbApi.dataCenterApi();
-
- try {
- boolean result = api.deleteDataCenter("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
- assertRequestHasCommonProperties(server.takeRequest());
- assertFalse(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/DrivesApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/DrivesApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/DrivesApiLiveTest.java
deleted file mode 100644
index ff4dbb4..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/DrivesApiLiveTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertNotNull;
-
-import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Drive;
-import org.jclouds.profitbricks.domain.Image;
-import org.jclouds.profitbricks.domain.Server;
-import org.testng.annotations.Test;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-
-@Test(groups = "live", testName = "DrivesApiLiveTest")
-public class DrivesApiLiveTest extends BaseProfitBricksLiveTest {
-
- private DataCenter dataCenter;
- private Server server;
- private Image image;
-
- @BeforeClass
- public void setupTest() {
- dataCenter = findOrCreateDataCenter("drivesApiLiveTest" + System.currentTimeMillis());
- server = findOrCreateServer(dataCenter);
- image = Iterables.tryFind(api.imageApi().getAllImages(), new Predicate<Image>() {
-
- @Override
- public boolean apply(Image input) {
- return input.location() == dataCenter.location()
- && input.type() == Image.Type.CDROM;
- }
- }).get();
- }
-
- @Test
- public void addRomDriveToServerTest() {
- assertDataCenterAvailable(dataCenter);
- String requestId = api.drivesApi().addRomDriveToServer(
- Drive.Request.AddRomDriveToServerPayload.builder()
- .serverId(server.id())
- .imageId(image.id())
- .deviceNumber("0")
- .build());
- assertNotNull(requestId);
- }
-
- @Test(dependsOnMethods = "addRomDriveToServerTest")
- public void removeRomDriveFromServerTest() {
- assertDataCenterAvailable(dataCenter);
- String requestId = api.drivesApi().removeRomDriveFromServer(image.id(), server.id());
- assertNotNull(requestId);
- }
-
- @AfterClass(alwaysRun = true)
- public void cleanUp() {
- destroyDataCenter(dataCenter);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/DrivesApiMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/DrivesApiMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/DrivesApiMockTest.java
deleted file mode 100644
index 38cdcf0..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/DrivesApiMockTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.Drive;
-import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
-import static org.jclouds.profitbricks.internal.BaseProfitBricksMockTest.mockWebServer;
-import static org.testng.Assert.assertNotNull;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "DrivesApiMockTest")
-public class DrivesApiMockTest extends BaseProfitBricksMockTest {
-
- @Test
- public void addRomDriveToServerTest() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/drives/drives-add.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- DrivesApi api = pbApi.drivesApi();
-
- String content = "<ws:addRomDriveToServer>"
- + "<request>"
- + "<imageId>image-id</imageId>"
- + "<serverId>server-id</serverId>"
- + "<deviceNumber>device-number</deviceNumber>"
- + "</request>"
- + "</ws:addRomDriveToServer>";
- try {
- String requestId = api.addRomDriveToServer(Drive.Request.AddRomDriveToServerPayload.builder()
- .serverId("server-id")
- .imageId("image-id")
- .deviceNumber("device-number")
- .build());
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(requestId);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void removeRomDriveFromServerTest() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/drives/drives-remove.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- DrivesApi api = pbApi.drivesApi();
-
- String content = "<ws:removeRomDriveFromServer>"
- + "<imageId>image-id</imageId>"
- + "<serverId>server-id</serverId>"
- + "</ws:removeRomDriveFromServer>";
- try {
- String requestId = api.removeRomDriveFromServer("image-id", "server-id");
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(requestId);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/FirewallApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/FirewallApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/FirewallApiLiveTest.java
deleted file mode 100644
index c5b63f2..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/FirewallApiLiveTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Firewall;
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.domain.Firewall.Protocol;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-
-@Test(groups = "live", testName = "FirewallApiLiveTest")
-public class FirewallApiLiveTest extends BaseProfitBricksLiveTest {
-
- private DataCenter dataCenter;
- private Nic nic;
-
- private Firewall createdFirewall;
-
- @BeforeClass
- public void setupTest() {
- dataCenter = findOrCreateDataCenter("firewallApiLiveTest" + System.currentTimeMillis());
- nic = findOrCreateNic(dataCenter);
- }
-
- @Test
- public void testAddFirewallRuleToNic() {
- assertDataCenterAvailable(dataCenter);
- Firewall firewall = api.firewallApi().addFirewallRuleToNic(
- Firewall.Request.createAddRulePayload(
- nic.id(), ImmutableList.of(
- Firewall.Rule.builder()
- .name("test-rule-tcp")
- .protocol(Protocol.TCP)
- .build()
- )
- )
- );
-
- assertNotNull(firewall);
- assertFalse(firewall.rules().isEmpty());
- assertDataCenterAvailable(dataCenter);
-
- createdFirewall = firewall;
- }
-
- @Test(dependsOnMethods = "testAddFirewallRuleToNic")
- public void testGetAllFirewalls() {
- List<Firewall> firewalls = api.firewallApi().getAllFirewalls();
-
- assertNotNull(firewalls);
- assertFalse(firewalls.isEmpty());
- }
-
- @Test(dependsOnMethods = "testAddFirewallRuleToNic")
- public void testGetFirewall() {
- Firewall firewall = api.firewallApi().getFirewall(createdFirewall.id());
-
- assertNotNull(firewall);
- assertEquals(createdFirewall.id(), firewall.id());
- }
-
- @Test(dependsOnMethods = "testAddFirewallRuleToNic")
- public void testActivateFirewall() {
- assertDataCenterAvailable(dataCenter);
- boolean result = api.firewallApi().activateFirewall(
- ImmutableList.of(createdFirewall.id()));
- assertDataCenterAvailable(dataCenter);
- assertTrue(result);
-
- Firewall firewall = api.firewallApi().getFirewall(createdFirewall.id());
- assertTrue(firewall.active(), "Firewall wasn't activated");
- }
-
- @Test(dependsOnMethods = "testActivateFirewall")
- void testDeactivateFirewall() {
- assertDataCenterAvailable(dataCenter);
- boolean result = api.firewallApi().deactivateFirewall(
- ImmutableList.of(createdFirewall.id()));
- assertDataCenterAvailable(dataCenter);
- assertTrue(result);
-
- Firewall firewall = api.firewallApi().getFirewall(createdFirewall.id());
- assertFalse(firewall.active(), "Firewall wasn't deactivated");
- }
-
- @Test(dependsOnMethods = "testDeactivateFirewall")
- void testRemoveFirewallRule() {
- assertDataCenterAvailable(dataCenter);
- for (Firewall.Rule rule : createdFirewall.rules()) {
- boolean result = api.firewallApi().removeFirewallRules(
- ImmutableList.of(rule.id()));
-
- assertTrue(result);
- assertDataCenterAvailable(dataCenter);
-
- }
- Firewall firewall = api.firewallApi().getFirewall(createdFirewall.id());
- assertTrue(firewall.rules().isEmpty(), "Not all rules removed");
- }
-
- @Test(dependsOnMethods = "testRemoveFirewallRule")
- public void testDeleteFirewall() {
- assertDataCenterAvailable(dataCenter);
- boolean result = api.firewallApi().deleteFirewall(ImmutableList.of(createdFirewall.id()));
- assertTrue(result, "Created firewall was not deleted.");
- }
-
- @AfterClass(alwaysRun = true)
- public void cleanUp() {
- destroyDataCenter(dataCenter);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/FirewallApiMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/FirewallApiMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/FirewallApiMockTest.java
deleted file mode 100644
index d9531cb..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/FirewallApiMockTest.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * 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 static org.jclouds.profitbricks.internal.BaseProfitBricksMockTest.mockWebServer;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-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.Firewall;
-import org.jclouds.profitbricks.domain.Firewall.Protocol;
-import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
-
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "live", testName = "FirewallApiMockTest", singleThreaded = true)
-public class FirewallApiMockTest extends BaseProfitBricksMockTest {
-
- @Test
- public void testGetAllFirewalls() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/firewall/firewalls.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-
- FirewallApi api = pbApi.firewallApi();
-
- try {
- List<Firewall> firewalls = api.getAllFirewalls();
- assertRequestHasCommonProperties(server.takeRequest(), "<ws:getAllFirewalls/>");
- assertNotNull(firewalls);
- assertEquals(firewalls.size(), 2);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetFirewall() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/firewall/firewall.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-
- FirewallApi api = pbApi.firewallApi();
-
- String id = "firewall-id";
- String firewallruleid = "firewall-rule-id";
-
- String content = "<ws:getFirewall><firewallId>" + id + "</firewallId></ws:getFirewall>";
-
- try {
- Firewall firewall = api.getFirewall(id);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(firewall);
- assertEquals(firewall.id(), id);
- assertFalse(firewall.rules().isEmpty());
- assertEquals(firewall.rules().get(0).id(), firewallruleid);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetNonExistingFirewall() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- FirewallApi api = pbApi.firewallApi();
-
- String id = "firewall-id";
-
- try {
- Firewall firewall = api.getFirewall(id);
- assertRequestHasCommonProperties(server.takeRequest());
- assertNull(firewall);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testAddFirewallRuleToNic() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/firewall/firewall-addtonic.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- FirewallApi api = pbApi.firewallApi();
-
- String content = "<ws:addFirewallRulesToNic>"
- + "<nicId>nic-id</nicId>"
- + "<request>"
- + "<name>name</name>"
- + "<portRangeEnd>45678</portRangeEnd>"
- + "<portRangeStart>12345</portRangeStart>"
- + "<protocol>TCP</protocol>"
- + "<sourceIp>192.168.0.1</sourceIp>"
- + "<sourceMac>aa:bb:cc:dd:ee:ff</sourceMac>"
- + "<targetIp>192.168.0.2</targetIp>"
- + "</request>"
- + "</ws:addFirewallRulesToNic>";
- try {
- Firewall.Request.AddRulePayload payload = Firewall.Request.createAddRulePayload(
- "nic-id", ImmutableList.of(
- Firewall.Rule.builder()
- .name("name")
- .portRangeEnd(45678)
- .portRangeStart(12345)
- .protocol(Protocol.TCP)
- .sourceIp("192.168.0.1")
- .sourceMac("aa:bb:cc:dd:ee:ff")
- .targetIp("192.168.0.2")
- .build()
- ));
- Firewall response = api.addFirewallRuleToNic(payload);
-
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(response);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testRemoveFirewall() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/firewall/firewall-remove.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- FirewallApi api = pbApi.firewallApi();
-
- String firewallId = "12345";
- String content = "<ws:removeFirewallRules>"
- + "<firewallRuleIds>" + firewallId + "</firewallRuleIds>"
- + "</ws:removeFirewallRules>";
-
- try {
- boolean result = api.removeFirewallRules(ImmutableList.of(firewallId));
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertTrue(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testRemoveNonExitingFirewall() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- FirewallApi api = pbApi.firewallApi();
-
- String firewallRuleId = "12345";
-
- try {
- boolean result = api.removeFirewallRules(ImmutableList.of(firewallRuleId));
- assertRequestHasCommonProperties(server.takeRequest());
- assertFalse(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testActivateFirewall() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/firewall/firewall-activate.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- FirewallApi api = pbApi.firewallApi();
-
- String firewallId = "12345";
- String content = "<ws:activateFirewalls>"
- + "<firewallIds>" + firewallId + "</firewallIds>"
- + "</ws:activateFirewalls>";
-
- try {
- boolean result = api.activateFirewall(ImmutableList.of(firewallId));
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertTrue(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testActivateNonExitingFirewall() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- FirewallApi api = pbApi.firewallApi();
-
- String firewallId = "12345";
-
- try {
- boolean result = api.activateFirewall(ImmutableList.of(firewallId));
- assertRequestHasCommonProperties(server.takeRequest());
- assertFalse(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDeactivateFirewall() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/firewall/firewall-deactivate.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- FirewallApi api = pbApi.firewallApi();
-
- String firewallId = "12345";
- String content = "<ws:deactivateFirewalls>"
- + "<firewallIds>" + firewallId + "</firewallIds>"
- + "</ws:deactivateFirewalls>";
-
- try {
- boolean result = api.deactivateFirewall(ImmutableList.of(firewallId));
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertTrue(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDeactivateNonExitingFirewall() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- FirewallApi api = pbApi.firewallApi();
-
- String firewallId = "12345";
-
- try {
- boolean result = api.deactivateFirewall(ImmutableList.of(firewallId));
- assertRequestHasCommonProperties(server.takeRequest());
- assertFalse(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDeleteFirewall() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/firewall/firewall-delete.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- FirewallApi api = pbApi.firewallApi();
-
- String firewallId = "12345";
- String content = "<ws:deleteFirewalls>"
- + "<firewallIds>" + firewallId + "</firewallIds>"
- + "</ws:deleteFirewalls>";
-
- try {
- boolean result = api.deleteFirewall(ImmutableList.of(firewallId));
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertTrue(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testDeleteNonExitingFirewall() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- FirewallApi api = pbApi.firewallApi();
-
- String firewallId = "12345";
-
- try {
- boolean result = api.deleteFirewall(ImmutableList.of(firewallId));
- assertRequestHasCommonProperties(server.takeRequest());
- assertFalse(result);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/ImageApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/ImageApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/ImageApiLiveTest.java
deleted file mode 100644
index b71cd8d..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/ImageApiLiveTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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 static org.testng.Assert.assertEquals;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
-import org.jclouds.profitbricks.domain.Image;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-@Test(groups = "live", testName = "ImageApiLiveTest")
-public class ImageApiLiveTest extends BaseProfitBricksLiveTest {
-
- private Image image;
-
- @Test
- public void testGetAllImages() {
- List<Image> images = api.imageApi().getAllImages();
-
- assertNotNull(images);
- assertFalse(images.isEmpty(), "No images found.");
-
- image = Iterables.getFirst(images, null);
- assertNotNull(image);
- }
-
- @Test(dependsOnMethods = "testGetAllImages")
- public void testGetImage() {
- Image fetchedImage = api.imageApi().getImage(image.id());
-
- assertNotNull(fetchedImage);
- assertEquals(fetchedImage, image);
- }
-
- @Test
- public void testGetNonExistingImage() {
- String id = "random-non-existing-id";
- assertNull(api.imageApi().getImage(id), "Should've just returned null");
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/ImageApiMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/ImageApiMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/ImageApiMockTest.java
deleted file mode 100644
index 6e97541..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/ImageApiMockTest.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-import java.util.List;
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.Image;
-import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
-import static org.jclouds.profitbricks.internal.BaseProfitBricksMockTest.mockWebServer;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-
-/**
- * Mock tests for the {@link org.jclouds.profitbricks.features.ImageApi} class
- */
-@Test(groups = "unit", testName = "ImageApiMockTest")
-public class ImageApiMockTest extends BaseProfitBricksMockTest {
-
- @Test
- public void testGetAllImages() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/image/images.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ImageApi api = pbApi.imageApi();
-
- try {
- List<Image> images = api.getAllImages();
- assertRequestHasCommonProperties(server.takeRequest(), "<ws:getAllImages/>");
- assertNotNull(images);
- assertTrue(images.size() == 7);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetAllImagesReturning404() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ImageApi api = pbApi.imageApi();
-
- try {
- List<Image> images = api.getAllImages();
- assertRequestHasCommonProperties(server.takeRequest());
- assertTrue(images.isEmpty());
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-
- @Test
- public void testGetImage() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setBody(payloadFromResource("/image/image.xml")));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ImageApi api = pbApi.imageApi();
-
- String id = "5ad99c9e-9166-11e4-9d74-52540066fee9";
-
- String content = "<ws:getImage><imageId>" + id + "</imageId></ws:getImage>";
- try {
- Image image = api.getImage(id);
- assertRequestHasCommonProperties(server.takeRequest(), content);
- assertNotNull(image);
- assertEquals(image.id(), id);
- } finally {
- pbApi.close();
- server.shutdown();
- }
-
- }
-
- @Test
- public void testGetNonExistingImage() throws Exception {
- MockWebServer server = mockWebServer();
- server.enqueue(new MockResponse().setResponseCode(404));
-
- ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
- ImageApi api = pbApi.imageApi();
-
- String id = "random-non-existing-id";
- try {
- Image image = api.getImage(id);
- assertRequestHasCommonProperties(server.takeRequest());
- assertNull(image);
- } finally {
- pbApi.close();
- server.shutdown();
- }
- }
-}
[06/11] jclouds-labs git commit: Remove ProfitBricks
Posted by de...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/BaseProfitBricksLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/BaseProfitBricksLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/BaseProfitBricksLiveTest.java
deleted file mode 100644
index 524149a..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/BaseProfitBricksLiveTest.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * 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;
-
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_SUSPENDED;
-import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.POLL_PREDICATE_DATACENTER;
-import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.POLL_PREDICATE_SNAPSHOT;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-import java.util.Objects;
-import java.util.Properties;
-
-import org.jclouds.apis.BaseApiLiveTest;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.domain.Server;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.features.DataCenterApi;
-import org.jclouds.profitbricks.features.ServerApi;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.FluentIterable;
-import com.google.inject.Injector;
-import com.google.inject.Key;
-import com.google.inject.Module;
-import com.google.inject.TypeLiteral;
-import com.google.inject.name.Names;
-
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.features.NicApi;
-
-public abstract class BaseProfitBricksLiveTest extends BaseApiLiveTest<ProfitBricksApi> {
-
- public static final Location testLocation = Location.US_LAS;
-
- private Predicate<String> dataCenterAvailable;
- private Predicate<String> snapshotAvailable;
- private Predicate<String> serverRunning;
- private Predicate<String> serverSuspended;
-
- public BaseProfitBricksLiveTest() {
- provider = "profitbricks";
- }
-
- @Override
- protected ProfitBricksApi create(Properties props, Iterable<Module> modules) {
- Injector injector = newBuilder().modules(modules).overrides(props).buildInjector();
- dataCenterAvailable = injector.getInstance(Key.get(new TypeLiteral<Predicate<String>>() {
- }, Names.named(POLL_PREDICATE_DATACENTER)));
- snapshotAvailable = injector.getInstance(Key.get(new TypeLiteral<Predicate<String>>() {
- }, Names.named(POLL_PREDICATE_SNAPSHOT)));
- serverRunning = injector.getInstance(Key.get(new TypeLiteral<Predicate<String>>() {
- }, Names.named(TIMEOUT_NODE_RUNNING)));
- serverSuspended = injector.getInstance(Key.get(new TypeLiteral<Predicate<String>>() {
- }, Names.named(TIMEOUT_NODE_SUSPENDED)));
-
- return injector.getInstance(ProfitBricksApi.class);
- }
-
- protected void assertDataCenterAvailable(DataCenter dataCenter) {
- assertDataCenterAvailable(dataCenter.id());
- }
-
- protected void assertDataCenterAvailable(String dataCenterId) {
- assertTrue(dataCenterAvailable.apply(dataCenterId),
- String.format("Datacenter %s wasn't available in the configured timeout", dataCenterId));
- }
-
- protected void assertSnapshotAvailable(String snapshotId){
- assertTrue(snapshotAvailable.apply(snapshotId),
- String.format("Snapshot %s wasn't available in the configured timeout", snapshotId));
- }
-
- protected void assertNodeRunning(String serverId) {
- assertTrue(serverRunning.apply(serverId), String.format("Server %s did not start in the configured timeout", serverId));
- }
-
- protected void assertNodeSuspended(String serverId) {
- assertTrue(serverSuspended.apply(serverId), String.format("Server %s did not stop in the configured timeout", serverId));
- }
-
- protected DataCenter findOrCreateDataCenter(final String name) {
- DataCenterApi dataCenterApi = api.dataCenterApi();
-
- return FluentIterable.from(dataCenterApi.getAllDataCenters()).firstMatch(new Predicate<DataCenter>() {
-
- @Override
- public boolean apply(DataCenter input) {
- boolean match = Objects.equals(input.name(), name);
- if (match && input.location() == testLocation)
- assertDataCenterAvailable(input);
-
- return match;
- }
- }).or(new Supplier<DataCenter>() {
-
- @Override
- public DataCenter get() {
- DataCenter dataCenter = api.dataCenterApi().createDataCenter(
- DataCenter.Request.creatingPayload(name, testLocation));
- assertDataCenterAvailable(dataCenter);
-
- return api.dataCenterApi().getDataCenter(dataCenter.id());
- }
- });
- }
-
- protected Server findOrCreateServer(final DataCenter dataCenter) {
- return FluentIterable.from(dataCenter.servers()).firstMatch(new Predicate<Server>() {
-
- @Override
- public boolean apply(Server input) {
- return input.state() == ProvisioningState.AVAILABLE;
- }
- }).or(new Supplier<Server>() {
-
- @Override
- public Server get() {
- ServerApi serverApi = api.serverApi();
- String name = String.format("server-%d", dataCenter.servers().size());
- String createdServerId = serverApi.createServer(
- Server.Request.creatingBuilder()
- .dataCenterId(dataCenter.id())
- .name(name)
- .cores(1)
- .ram(256)
- .build());
- assertDataCenterAvailable(dataCenter);
- assertNodeRunning(createdServerId);
-
- return serverApi.getServer(createdServerId);
- }
- });
- }
-
- protected Nic findOrCreateNic(final DataCenter dataCenter) {
- final NicApi nicApi = api.nicApi();
- final List<Nic> nics = nicApi.getAllNics();
-
- return FluentIterable.from(nics).firstMatch(new Predicate<Nic>() {
-
- @Override
- public boolean apply(Nic input) {
- return Objects.equals(input.dataCenterId(), dataCenter.id())
- && input.state() == ProvisioningState.AVAILABLE;
- }
- }).or(new Supplier<Nic>() {
-
- @Override
- public Nic get() {
- Server server = findOrCreateServer(dataCenter);
- String name = String.format("%s-nic-%d", server.name(), nics.size());
- String nicId = nicApi.createNic(Nic.Request.creatingBuilder()
- .name(name)
- .lanId(1)
- .serverId(server.id())
- .build());
- assertDataCenterAvailable(dataCenter);
-
- return nicApi.getNic(nicId);
- }
- });
- }
-
- protected void destroyDataCenter(final DataCenter dataCenter) {
- boolean success = api.dataCenterApi().deleteDataCenter(dataCenter.id());
- assertTrue(success, "DataCenter wasn't deleted");
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/ProfitBricksProviderMetadataTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/ProfitBricksProviderMetadataTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/ProfitBricksProviderMetadataTest.java
deleted file mode 100644
index 210eeb9..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/ProfitBricksProviderMetadataTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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;
-
-import org.jclouds.providers.internal.BaseProviderMetadataTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ProfitBricksProviderMetadataTest")
-public class ProfitBricksProviderMetadataTest extends BaseProviderMetadataTest {
-
- public ProfitBricksProviderMetadataTest() {
- super(new ProfitBricksProviderMetadata(), new ProfitBricksApiMetadata());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/datacenter/CreateDataCenterRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/datacenter/CreateDataCenterRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/datacenter/CreateDataCenterRequestBinderTest.java
deleted file mode 100644
index 5190d6f..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/datacenter/CreateDataCenterRequestBinderTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.datacenter;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Location;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "CreateDataCenterRequestBinderTest")
-public class CreateDataCenterRequestBinderTest {
-
- @Test
- public void testCreatePayload() {
- CreateDataCenterRequestBinder binder = new CreateDataCenterRequestBinder();
-
- DataCenter.Request.CreatePayload payload = DataCenter.Request.creatingPayload("JClouds-DC", Location.DE_FKB);
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(expectedPayload, actual);
- }
-
- private final String expectedPayload
- = (" <ws:createDataCenter>\n"
- + " <request>\n"
- + " <dataCenterName>JClouds-DC</dataCenterName>\n"
- + " <location>de/fkb</location>\n"
- + " </request>\n"
- + " </ws:createDataCenter>\n").replaceAll("\\s+", "");
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/datacenter/UpdateDataCenterRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/datacenter/UpdateDataCenterRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/datacenter/UpdateDataCenterRequestBinderTest.java
deleted file mode 100644
index 589fc69..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/datacenter/UpdateDataCenterRequestBinderTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.datacenter;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "UpdateDataCenterRequestBinderTest")
-public class UpdateDataCenterRequestBinderTest {
-
- @Test
- public void testCreatePayload() {
- UpdateDataCenterRequestBinder binder = new UpdateDataCenterRequestBinder();
-
- DataCenter.Request.UpdatePayload payload = DataCenter.Request.updatingPayload("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", "Apache-DC");
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(expectedPayload, actual);
- }
-
- private final String expectedPayload
- = (" <ws:updateDataCenter>\n"
- + " <request>\n"
- + " <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>\n"
- + " <dataCenterName>Apache-DC</dataCenterName>\n"
- + " </request>\n"
- + " </ws:updateDataCenter>").replaceAll("\\s+", "");
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/drive/AddRomDriveToServerRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/drive/AddRomDriveToServerRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/drive/AddRomDriveToServerRequestBinderTest.java
deleted file mode 100644
index 134b62f..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/drive/AddRomDriveToServerRequestBinderTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.drive;
-
-import org.jclouds.profitbricks.domain.Drive;
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "AddRomDriveToServerRequestBinderTest")
-public class AddRomDriveToServerRequestBinderTest {
-
- @Test
- public void testAddRomDriveToServerPayload() {
- AddRomDriveToServerRequestBinder binder = new AddRomDriveToServerRequestBinder();
-
- Drive.Request.AddRomDriveToServerPayload payload = Drive.Request.AddRomDriveToServerPayload.builder()
- .serverId("server-id")
- .imageId("image-id")
- .deviceNumber("device-number")
- .build();
-
- String actual = binder.createPayload(payload);
- assertEquals(expectedPayload, actual);
- }
-
- private final String expectedPayload
- = (" <ws:addRomDriveToServer>"
- + " <request>"
- + " <imageId>image-id</imageId>"
- + " <serverId>server-id</serverId>"
- + " <deviceNumber>device-number</deviceNumber>"
- + " </request>"
- + " </ws:addRomDriveToServer>").replaceAll("\\s+", "");
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/firewall/AddFirewallRuleToNicRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/firewall/AddFirewallRuleToNicRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/firewall/AddFirewallRuleToNicRequestBinderTest.java
deleted file mode 100644
index 0e074a6..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/firewall/AddFirewallRuleToNicRequestBinderTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.firewall;
-
-import org.jclouds.profitbricks.domain.Firewall;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import com.google.common.collect.ImmutableList;
-
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "AddFirewallRuleToNicRequestBinderTest")
-public class AddFirewallRuleToNicRequestBinderTest {
-
- @Test
- public void testCreatePayload() {
- AddFirewallRuleToNicRequestBinder binder = new AddFirewallRuleToNicRequestBinder();
-
- Firewall.Request.AddRulePayload payload = Firewall.Request.createAddRulePayload(
- "nic-id", ImmutableList.of(
- Firewall.Rule.builder()
- .name("name")
- .portRangeEnd(45678)
- .portRangeStart(12345)
- .protocol(Firewall.Protocol.TCP)
- .sourceIp("192.168.0.1")
- .sourceMac("aa:bb:cc:dd:ee:ff")
- .targetIp("192.168.0.2")
- .build()
- ));
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(expectedPayload, actual);
- }
-
- private final String expectedPayload = (" <ws:addFirewallRulesToNic>\n"
- + " <nicId>nic-id</nicId>\n"
- + " <request>\n"
- + " <name>name</name>\n"
- + " <portRangeEnd>45678</portRangeEnd>\n"
- + " <portRangeStart>12345</portRangeStart>\n"
- + " <protocol>TCP</protocol>\n"
- + " <sourceIp>192.168.0.1</sourceIp>\n"
- + " <sourceMac>aa:bb:cc:dd:ee:ff</sourceMac>\n"
- + " <targetIp>192.168.0.2</targetIp>\n"
- + " </request>\n"
- + " </ws:addFirewallRulesToNic>").replaceAll("\\s+", "");
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/firewall/FirewallBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/firewall/FirewallBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/firewall/FirewallBinderTest.java
deleted file mode 100644
index e32b788..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/firewall/FirewallBinderTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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.firewall;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.binder.firewall.FirewallBinder.ActivateFirewallRequestBinder;
-import org.jclouds.profitbricks.binder.firewall.FirewallBinder.DeactivateFirewallRequestBinder;
-import org.jclouds.profitbricks.binder.firewall.FirewallBinder.DeleteFirewallRequestBinder;
-import org.jclouds.profitbricks.binder.firewall.FirewallBinder.RemoveFirewallRuleRequestBinder;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit", testName = "FirewallBinderTest")
-public class FirewallBinderTest {
-
- @Test
- public void testActivateFirewallBindPayload() {
- ActivateFirewallRequestBinder binder = new ActivateFirewallRequestBinder();
-
- List<String> payload = ImmutableList.of(
- "firewall-id-1",
- "firewall-id-2",
- "firewall-id-3",
- "firewall-id-4"
- );
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
-
- String expected = ("<ws:activateFirewalls>\n"
- + " <firewallIds>firewall-id-1</firewallIds>\n"
- + " <firewallIds>firewall-id-2</firewallIds>\n"
- + " <firewallIds>firewall-id-3</firewallIds>\n"
- + " <firewallIds>firewall-id-4</firewallIds>\n"
- + " </ws:activateFirewalls>").replaceAll("\\s+", "");
-
- assertEquals(actual, expected);
- }
-
- @Test
- public void testDeactivateFirewallBindPayload() {
- DeactivateFirewallRequestBinder binder = new DeactivateFirewallRequestBinder();
-
- List<String> payload = ImmutableList.of(
- "firewall-id-1",
- "firewall-id-2",
- "firewall-id-3",
- "firewall-id-4"
- );
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
-
- String expected = ("<ws:deactivateFirewalls>\n"
- + " <firewallIds>firewall-id-1</firewallIds>\n"
- + " <firewallIds>firewall-id-2</firewallIds>\n"
- + " <firewallIds>firewall-id-3</firewallIds>\n"
- + " <firewallIds>firewall-id-4</firewallIds>\n"
- + " </ws:deactivateFirewalls>").replaceAll("\\s+", "");
-
- assertEquals(actual, expected);
- }
-
- @Test
- public void testDeleteFirewallBindPayload() {
- DeleteFirewallRequestBinder binder = new DeleteFirewallRequestBinder();
-
- List<String> payload = ImmutableList.of(
- "firewall-id-1",
- "firewall-id-2",
- "firewall-id-3",
- "firewall-id-4"
- );
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
-
- String expected = ("<ws:deleteFirewalls>\n"
- + " <firewallIds>firewall-id-1</firewallIds>\n"
- + " <firewallIds>firewall-id-2</firewallIds>\n"
- + " <firewallIds>firewall-id-3</firewallIds>\n"
- + " <firewallIds>firewall-id-4</firewallIds>\n"
- + " </ws:deleteFirewalls>").replaceAll("\\s+", "");
-
- assertEquals(actual, expected);
- }
-
- @Test
- public void testRemoveFirewallRuleBindPayload() {
- RemoveFirewallRuleRequestBinder binder = new RemoveFirewallRuleRequestBinder();
-
- List<String> payload = ImmutableList.of(
- "firewall-rule-id-1",
- "firewall-rule-id-2",
- "firewall-rule-id-3",
- "firewall-rule-id-4"
- );
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
-
- String expected = ("<ws:removeFirewallRules>\n"
- + " <firewallRuleIds>firewall-rule-id-1</firewallRuleIds>\n"
- + " <firewallRuleIds>firewall-rule-id-2</firewallRuleIds>\n"
- + " <firewallRuleIds>firewall-rule-id-3</firewallRuleIds>\n"
- + " <firewallRuleIds>firewall-rule-id-4</firewallRuleIds>\n"
- + " </ws:removeFirewallRules>").replaceAll("\\s+", "");
-
- assertEquals(actual, expected);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 4744986..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/CreateLoadBalancerRequestBinderTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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 org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.ImmutableList;
-
-import org.testng.annotations.Test;
-import org.jclouds.profitbricks.domain.LoadBalancer;
-import org.jclouds.profitbricks.domain.LoadBalancer.Algorithm;
-
-@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.creatingBuilder()
- .dataCenterId("datacenter-id")
- .name("load-balancer-name")
- .algorithm(Algorithm.ROUND_ROBIN)
- .ip("10.0.0.1")
- .lanId(2)
- .serverIds(ImmutableList.<String>of(
- "server-id-1", "server-id-2"))
- .build());
-
- 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>10.0.0.1</ip>\n"
- + " <lanId>2</lanId>\n"
- + " <serverIds>server-id-1</serverIds>\n"
- + " <serverIds>server-id-2</serverIds>\n"
- + " </request>\n"
- + " </ws:createLoadBalancer>").replaceAll("\\s+", "");
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index c690fb3..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinderTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import com.google.common.collect.ImmutableList;
-
-import org.jclouds.profitbricks.domain.LoadBalancer;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "DeregisterLoadBalancerRequestBinderTest")
-public class DeregisterLoadBalancerRequestBinderTest {
-
- @Test
- public void testDeregisterPayload() {
- DeregisterLoadBalancerRequestBinder binder = new DeregisterLoadBalancerRequestBinder();
-
- String actual = binder.createPayload(LoadBalancer.Request.createDeregisteringPayload(
- "load-balancer-id", ImmutableList.of("1", "2")));
-
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(expectedPayload, actual);
- }
-
- private final String expectedPayload
- = (" <ws:deregisterServersOnLoadBalancer>\n"
- + " <serverIds>1</serverIds>\n"
- + " <serverIds>2</serverIds>\n"
- + " <loadBalancerId>load-balancer-id</loadBalancerId>\n"
- + " </ws:deregisterServersOnLoadBalancer>").replaceAll("\\s+", "");
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index 8f2e5a9..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinderTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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 org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.profitbricks.domain.LoadBalancer;
-
-import com.google.common.collect.ImmutableList;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "RegisterLoadBalancerRequestBinderTest")
-public class RegisterLoadBalancerRequestBinderTest {
-
- @Test
- public void testRegisterPayload() {
- RegisterLoadBalancerRequestBinder binder = new RegisterLoadBalancerRequestBinder();
- String actual = binder.createPayload(LoadBalancer.Request.createRegisteringPaylod(
- "load-balancer-id", ImmutableList.of("1", "2")));
-
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(expectedPayload, actual);
- }
-
- private final String expectedPayload
- = (" <ws:registerServersOnLoadBalancer>\n"
- + " <loadBalancerId>load-balancer-id</loadBalancerId>\n"
- + " <serverIds>1</serverIds>\n"
- + " <serverIds>2</serverIds>\n"
- + " </ws:registerServersOnLoadBalancer>").replaceAll("\\s+", "");
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/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
deleted file mode 100644
index b638c89..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/UpdateLoadBalancerRequestBinderTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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 org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import org.jclouds.profitbricks.domain.LoadBalancer;
-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.updatingBuilder()
- .id("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
- .name("load-balancer-name")
- .algorithm(LoadBalancer.Algorithm.ROUND_ROBIN)
- .ip("10.0.0.2")
- .build();
-
- 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>10.0.0.2</ip> \n"
- + " </request>\n"
- + " </ws:updateLoadBalancer>").replaceAll("\\s+", "");
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/nic/CreateNicRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/nic/CreateNicRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/nic/CreateNicRequestBinderTest.java
deleted file mode 100644
index 8e2630d..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/nic/CreateNicRequestBinderTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.nic;
-
-import org.jclouds.profitbricks.domain.Nic;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "CreateNicRequestBinderTest")
-public class CreateNicRequestBinderTest {
-
- @Test
- public void testCreatePayload() {
- CreateNicRequestBinder binder = new CreateNicRequestBinder();
-
- Nic.Request.CreatePayload payload = Nic.Request.creatingBuilder()
- .ip("192.168.0.1")
- .name("nic-name")
- .dhcpActive(true)
- .serverId("server-id")
- .lanId(1)
- .build();
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(expectedPayload, actual);
- }
-
- private final String expectedPayload = ("<ws:createNic>\n"
- + " <request>\n"
- + " <ip>192.168.0.1</ip>\n"
- + " <nicName>nic-name</nicName>\n"
- + " <dhcpActive>true</dhcpActive>\n"
- + " <serverId>server-id</serverId>\n"
- + " <lanId>1</lanId>\n"
- + " </request>\n"
- + " </ws:createNic>").replaceAll("\\s+", "");
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/nic/SetInternetAccessBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/nic/SetInternetAccessBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/nic/SetInternetAccessBinderTest.java
deleted file mode 100644
index c499c73..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/nic/SetInternetAccessBinderTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.nic;
-
-import org.jclouds.profitbricks.domain.Nic;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "SetInternetAccessBinderTest")
-public class SetInternetAccessBinderTest {
-
- @Test
- public void testCreatePayload() {
- SetInternetAccessBinder binder = new SetInternetAccessBinder();
-
- Nic.Request.SetInternetAccessPayload payload = Nic.Request.setInternetAccessBuilder()
- .dataCenterId("datacenter-id")
- .internetAccess(true)
- .lanId(1)
- .build();
-
- String actual = binder.createPayload(payload);
-
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(expectedPayload, actual);
- }
-
- private final String expectedPayload = (" <ws:setInternetAccess>\n"
- + " <dataCenterId>datacenter-id</dataCenterId>\n"
- + " <lanId>1</lanId>\n"
- + " <internetAccess>true</internetAccess>\n"
- + " </ws:setInternetAccess>").replaceAll("\\s+", "");
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/nic/UpdateNicRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/nic/UpdateNicRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/nic/UpdateNicRequestBinderTest.java
deleted file mode 100644
index 298fea7..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/nic/UpdateNicRequestBinderTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.nic;
-
-import org.jclouds.profitbricks.domain.Nic;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "UpdateNicRequestBinderTest")
-public class UpdateNicRequestBinderTest {
-
- @Test
- public void testCreatePayload() {
- UpdateNicRequestBinder binder = new UpdateNicRequestBinder();
-
- Nic.Request.UpdatePayload payload = Nic.Request.updatingBuilder()
- .id("nic-id")
- .ip("192.168.0.1")
- .name("nic-name")
- .dhcpActive(true)
- .lanId(1)
- .build();
-
- String actual = binder.createPayload(payload);
-
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(expectedPayload, actual);
- }
-
- private final String expectedPayload = (" <ws:updateNic>\n"
- + " <request>\n"
- + " <nicId>nic-id</nicId>\n"
- + " <ip>192.168.0.1</ip>\n"
- + " <nicName>nic-name</nicName>\n"
- + " <dhcpActive>true</dhcpActive>\n"
- + " <lanId>1</lanId>\n"
- + " </request>\n"
- + " </ws:updateNic>").replaceAll("\\s+", "");
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/server/CreateServerRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/server/CreateServerRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/server/CreateServerRequestBinderTest.java
deleted file mode 100644
index 355f318..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/server/CreateServerRequestBinderTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.server;
-
-import org.jclouds.profitbricks.domain.Server;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "CreateServerRequestBinderTest")
-public class CreateServerRequestBinderTest {
-
- @Test
- public void testCreatePayload() {
- CreateServerRequestBinder binder = new CreateServerRequestBinder();
-
- Server.Request.CreatePayload payload = Server.Request.creatingBuilder()
- .name("jclouds-node")
- .cores(4)
- .ram(4 * 1024)
- .dataCenterId("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
- .build();
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(actual, expectedPayload);
- }
-
- private final String expectedPayload
- = (" <ws:createServer>\n"
- + " <request>\n"
- + " <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>\n"
- + " <cores>4</cores>\n"
- + " <ram>4096</ram>\n"
- + " <serverName>jclouds-node</serverName>\n"
- // + " <bootFromStorageId>?</bootFromStorageId>\n"
- // + " <bootFromImageId>?</bootFromImageId>\n"
- // + " <internetAccess>false</internetAccess>\n"
- // + " <lanId>?</lanId>\n"
- // + " <osType>?</osType>\n"
- // + " <availabilityZone>AUTO</availabilityZone>\n"
- // + " <cpuHotPlug>false</cpuHotPlug>\n"
- // + " <ramHotPlug>false</ramHotPlug>\n"
- // + " <nicHotPlug>false</nicHotPlug>\n"
- // + " <nicHotUnPlug>false</nicHotUnPlug>\n"
- // + " <discVirtioHotPlug>false</discVirtioHotPlug>\n"
- // + " <discVirtioHotUnPlug>false</discVirtioHotUnPlug>\n"
- + " </request>\n"
- + " </ws:createServer>")
- .replaceAll("\\s+", "");
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/server/UpdateServerRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/server/UpdateServerRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/server/UpdateServerRequestBinderTest.java
deleted file mode 100644
index aa0e31c..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/server/UpdateServerRequestBinderTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.server;
-
-import org.jclouds.profitbricks.domain.Server;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "UpdateServerRequestBinderTest")
-public class UpdateServerRequestBinderTest {
-
- @Test
- public void testCreatePayload() {
- UpdateServerRequestBinder binder = new UpdateServerRequestBinder();
-
- Server.Request.UpdatePayload payload = Server.Request.updatingBuilder()
- .id("qwertyui-qwer-qwer-qwer-qwertyyuiiop")
- .cores(8)
- .ram(8 * 1024)
- .name("apache-node")
- .build();
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(actual, expectedPayload);
- }
-
- private final String expectedPayload
- = (" <ws:updateServer>\n"
- + " <request>\n"
- + " <serverId>qwertyui-qwer-qwer-qwer-qwertyyuiiop</serverId>\n"
- + " <cores>8</cores>\n"
- + " <ram>8192</ram>\n"
- + " <serverName>apache-node</serverName>\n"
- // + " <bootFromStorageId>?</bootFromStorageId>\n"
- // + " <bootFromImageId>?</bootFromImageId>\n"
- // + " <osType>?</osType>\n"
- // + " <availabilityZone>?</availabilityZone>\n"
- // + " <cpuHotPlug>?</cpuHotPlug>\n"
- // + " <ramHotPlug>?</ramHotPlug>\n"
- // + " <nicHotPlug>?</nicHotPlug>\n"
- // + " <nicHotUnPlug>?</nicHotUnPlug>\n"
- // + " <discVirtioHotPlug>?</discVirtioHotPlug>\n"
- // + " <discVirtioHotUnPlug>?</discVirtioHotUnPlug>\n"
- + " </request>\n"
- + " </ws:updateServer>")
- .replaceAll("\\s+", "");
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/snapshot/CreateSnapshotRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/snapshot/CreateSnapshotRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/snapshot/CreateSnapshotRequestBinderTest.java
deleted file mode 100644
index 8a9c581..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/snapshot/CreateSnapshotRequestBinderTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.snapshot;
-
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-@Test(groups = "unit", testName = "CreateSnapshotRequestBinderTest")
-public class CreateSnapshotRequestBinderTest {
-
- @Test
- public void testCreatePayload() {
- CreateSnapshotRequestBinder binder = new CreateSnapshotRequestBinder();
-
- Snapshot.Request.CreatePayload payload = Snapshot.Request.creatingBuilder()
- .storageId("123-1233-1324")
- .name("snapshot-name")
- .description("describing-the-snapshot")
- .build();
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(expectedPayload, actual);
- }
-
- private final String expectedPayload
- = (" <ws:createSnapshot>\n"
- + "<request>\n"
- + "<storageId>123-1233-1324</storageId>\n"
- + "<description>describing-the-snapshot</description>\n"
- + "<snapshotName>snapshot-name</snapshotName>\n"
- + "</request>\n"
- + "</ws:createSnapshot>").replaceAll("\\s+", "");
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/snapshot/RollbackSnapshotRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/snapshot/RollbackSnapshotRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/snapshot/RollbackSnapshotRequestBinderTest.java
deleted file mode 100644
index 87a043c..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/snapshot/RollbackSnapshotRequestBinderTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.snapshot;
-
-import org.jclouds.profitbricks.domain.Snapshot;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "RollbackSnapshotRequestBinderTest")
-public class RollbackSnapshotRequestBinderTest {
-
- @Test
- public void testRollbackPayload() {
- RollbackSnapshotRequestBinder binder = new RollbackSnapshotRequestBinder();
-
- Snapshot.Request.RollbackPayload payload = Snapshot.Request.createRollbackPayload("snapshot-id", "storage-id");
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(expectedPayload, actual);
- }
-
- private final String expectedPayload = "<ws:rollbackSnapshot>"
- + "<request>"
- + "<snapshotId>snapshot-id</snapshotId>"
- + "<storageId>storage-id</storageId>"
- + "</request>"
- + "</ws:rollbackSnapshot>".replaceAll("\\s", "");
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/snapshot/UpdateSnapshotRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/snapshot/UpdateSnapshotRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/snapshot/UpdateSnapshotRequestBinderTest.java
deleted file mode 100644
index 1809a1c..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/snapshot/UpdateSnapshotRequestBinderTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.snapshot;
-
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-@Test(groups = "unit", testName = "UpdateSnapshotRequestBinderTest")
-public class UpdateSnapshotRequestBinderTest {
-
- @Test
- public void testUpdatePayload() {
- UpdateSnapshotRequestBinder binder = new UpdateSnapshotRequestBinder();
-
- Snapshot.Request.UpdatePayload payload = Snapshot.Request.updatingBuilder()
- .id("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
- .description("description")
- .name("snapshot-name")
- .bootable(true)
- .osType(OsType.LINUX)
- .isCpuHotPlug(true)
- .isCpuHotUnPlug(true)
- .isRamHotPlug(true)
- .isRamHotUnPlug(true)
- .isNicHotPlug(true)
- .isNicHotUnPlug(true)
- .isDiscVirtioHotPlug(true)
- .isDiscVirtioHotUnPlug(true)
- .build();
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(expectedPayload, actual);
-
- }
-
- private final String expectedPayload
- = "<ws:updateSnapshot>"
- + "<request>"
- + "<snapshotId>qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh</snapshotId>"
- + "<description>description</description>"
- + "<snapshotName>snapshot-name</snapshotName>"
- + "<bootable>true</bootable>"
- + "<osType>LINUX</osType>"
- + "<cpuHotPlug>true</cpuHotPlug>"
- + "<cpuHotUnPlug>true</cpuHotUnPlug>"
- + "<ramHotPlug>true</ramHotPlug>"
- + "<ramHotUnPlug>true</ramHotUnPlug>"
- + "<nicHotPlug>true</nicHotPlug>"
- + "<nicHotUnPlug>true</nicHotUnPlug>"
- + "<discVirtioHotPlug>true</discVirtioHotPlug>"
- + "<discVirtioHotUnPlug>true</discVirtioHotUnPlug>"
- + "</request>"
- + "</ws:updateSnapshot>".replaceAll("\\s", "");
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/storage/ConnectStorageToServerRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/storage/ConnectStorageToServerRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/storage/ConnectStorageToServerRequestBinderTest.java
deleted file mode 100644
index 0c0d3a4..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/storage/ConnectStorageToServerRequestBinderTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.storage;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.profitbricks.domain.Storage;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ConnectStorageToServerRequestBinderTest")
-public class ConnectStorageToServerRequestBinderTest {
-
- @Test
- public void testCreatePayload() {
- ConnectStorageToServerRequestBinder binder = new ConnectStorageToServerRequestBinder();
-
- Storage.Request.ConnectPayload payload = Storage.Request.connectingBuilder()
- .serverId("qwertyui-qwer-qwer-qwer-qwertyyuiiop")
- .storageId("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
- .busType(Storage.BusType.VIRTIO)
- .deviceNumber(2)
- .build();
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(actual, expectedPayload);
- }
-
- private final String expectedPayload
- = (" <ws:connectStorageToServer>\n"
- + " <request>\n"
- + " <storageId>qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh</storageId>\n"
- + " <serverId>qwertyui-qwer-qwer-qwer-qwertyyuiiop</serverId>\n"
- + " <busType>VIRTIO</busType>\n"
- + " <deviceNumber>2</deviceNumber>\n"
- + " </request>\n"
- + " </ws:connectStorageToServer>")
- .replaceAll("\\s+", "");
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/storage/CreateStorageRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/storage/CreateStorageRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/storage/CreateStorageRequestBinderTest.java
deleted file mode 100644
index 9120be7..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/storage/CreateStorageRequestBinderTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.storage;
-
-import org.jclouds.profitbricks.domain.Storage;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "CreateStorageRequestBinderTest")
-public class CreateStorageRequestBinderTest {
-
- @Test
- public void testCreatePayload() {
- CreateStorageRequestBinder binder = new CreateStorageRequestBinder();
-
- Storage.Request.CreatePayload payload = Storage.Request.creatingBuilder()
- .name("hdd-1")
- .size(60f)
- .dataCenterId("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
- .mountImageId("5ad99c9e-9166-11e4-9d74-52540066fee9")
- .imagePassword("qqqqqqqqq")
- .build();
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(actual, expectedPayload);
- }
-
- private final String expectedPayload
- = (" <ws:createStorage>\n"
- + " <request>\n"
- + " <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>\n"
- + " <storageName>hdd-1</storageName>\n"
- + " <size>60</size>\n"
- + " <mountImageId>5ad99c9e-9166-11e4-9d74-52540066fee9</mountImageId>\n"
- + " <profitBricksImagePassword>qqqqqqqqq</profitBricksImagePassword>\n"
- + " </request>\n"
- + " </ws:createStorage>")
- .replaceAll("\\s+", "");
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/binder/storage/UpdateStorageRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/storage/UpdateStorageRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/storage/UpdateStorageRequestBinderTest.java
deleted file mode 100644
index 0240297..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/storage/UpdateStorageRequestBinderTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.storage;
-
-import org.jclouds.profitbricks.domain.Storage;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "UpdateStorageRequestBinderTest")
-public class UpdateStorageRequestBinderTest {
-
- @Test
- public void testUpdatePayload() {
- UpdateStorageRequestBinder binder = new UpdateStorageRequestBinder();
-
- Storage.Request.UpdatePayload payload = Storage.Request.updatingBuilder()
- .id("pppppppp-llkl-kkjk-fhgh-vnmegrdgdsgr")
- .size(100f)
- .name("hdd-2")
- .mountImageId("5f3cac96-915f-11e4-9d74-52540066fee9")
- .build();
-
- String actual = binder.createPayload(payload);
- assertNotNull(actual, "Binder returned null payload");
- assertEquals(actual, expectedPayload);
- }
-
- private final String expectedPayload
- = (" <ws:updateStorage>\n"
- + " <request>\n"
- + " <storageId>pppppppp-llkl-kkjk-fhgh-vnmegrdgdsgr</storageId>\n"
- + " <size>100</size>\n"
- + " <storageName>hdd-2</storageName>\n"
- + " <mountImageId>5f3cac96-915f-11e4-9d74-52540066fee9</mountImageId>\n"
- + " </request>\n"
- + " </ws:updateStorage>")
- .replaceAll("\\s+", "");
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/compute/ProfitBricksComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/compute/ProfitBricksComputeServiceLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/compute/ProfitBricksComputeServiceLiveTest.java
deleted file mode 100644
index 0061090..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/compute/ProfitBricksComputeServiceLiveTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.compute;
-
-import org.jclouds.compute.domain.ExecResponse;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
-import org.jclouds.logging.config.LoggingModule;
-import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
-import org.jclouds.sshj.config.SshjSshClientModule;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
-@Test(groups = "live", singleThreaded = true, testName = "ProfitBricksComputeServiceLiveTest")
-public class ProfitBricksComputeServiceLiveTest extends BaseComputeServiceLiveTest {
-
- public ProfitBricksComputeServiceLiveTest() {
- provider = "profitbricks";
- }
-
- @Override
- protected Module getSshModule() {
- return new SshjSshClientModule();
- }
-
- @Override
- protected LoggingModule getLoggingModule() {
- return new SLF4JLoggingModule();
- }
-
- @Override
- public void testOptionToNotBlock() throws Exception {
- // ProfitBricks implementation intentionally blocks until the node is 'AVAILABLE'
- }
-
- @Override
- protected void checkTagsInNodeEquals(NodeMetadata node, ImmutableSet<String> tags) {
- // ProfitBricks doesn't support tags
- }
-
- @Override
- protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
- // ProfitBricks doesn't support user metadata
- }
-
- @Override
- protected void checkResponseEqualsHostname(ExecResponse execResponse, NodeMetadata node1) {
- // ProfitBricks doesn't support hostname
- }
-
- @Override
- protected void checkOsMatchesTemplate(NodeMetadata node) {
- // Not enough description from API to match template
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/compute/ProfitBricksTemplateBuilderLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/compute/ProfitBricksTemplateBuilderLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/compute/ProfitBricksTemplateBuilderLiveTest.java
deleted file mode 100644
index f81ca28..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/compute/ProfitBricksTemplateBuilderLiveTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.compute;
-
-import static org.jclouds.profitbricks.BaseProfitBricksLiveTest.testLocation;
-import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.POLL_PREDICATE_DATACENTER;
-
-import java.util.Objects;
-import java.util.Set;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Key;
-import com.google.inject.TypeLiteral;
-import com.google.inject.name.Names;
-
-import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest;
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.features.DataCenterApi;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", testName = "ProfitBricksTemplateBuilderLiveTest", singleThreaded = true)
-public class ProfitBricksTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
-
- private static final String TEST_DC_NAME = "templateBuilderLiveTest-" + System.currentTimeMillis();
-
- private DataCenter dataCenter;
-
- public ProfitBricksTemplateBuilderLiveTest() {
- this.provider = "profitbricks";
- }
-
- @BeforeClass
- @Override
- public void setupContext() {
- super.setupContext();
-
- final DataCenterApi api = getDataCenterApi();
- final Predicate<String> predicate = getDataCenterPredicate();
- dataCenter = FluentIterable.from(api.getAllDataCenters()).firstMatch(new Predicate<DataCenter>() {
-
- @Override
- public boolean apply(DataCenter input) {
- boolean match = Objects.equals(input.name(), TEST_DC_NAME);
- if (match && input.location() == testLocation)
- return predicate.apply(input.id());
- return match;
- }
- }).or(new Supplier<DataCenter>() {
-
- @Override
- public DataCenter get() {
- DataCenter dataCenter = api.createDataCenter(
- DataCenter.Request.creatingPayload(TEST_DC_NAME, testLocation));
- predicate.apply(dataCenter.id());
-
- return api.getDataCenter(dataCenter.id());
- }
- });
- }
-
- private Predicate<String> getDataCenterPredicate() {
- return view.utils().injector().getInstance(Key.get(new TypeLiteral<Predicate<String>>() {
- }, Names.named(POLL_PREDICATE_DATACENTER)));
- }
-
- private DataCenterApi getDataCenterApi() {
- return view.unwrapApi(ProfitBricksApi.class).dataCenterApi();
- }
-
- @AfterClass(groups = {"integration", "live"}, alwaysRun = true)
- @Override
- protected void tearDownContext() {
- super.tearDownContext();
- if (dataCenter != null)
- getDataCenterApi().deleteDataCenter(dataCenter.id());
- }
-
- @Override
- protected Set<String> getIso3166Codes() {
- return ImmutableSet.of();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/compute/concurrent/ProvisioningManagerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/compute/concurrent/ProvisioningManagerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/compute/concurrent/ProvisioningManagerTest.java
deleted file mode 100644
index dd115cc..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/compute/concurrent/ProvisioningManagerTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.compute.concurrent;
-
-import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
-import static java.util.logging.Logger.getAnonymousLogger;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.base.Throwables;
-
-@Test(groups = "unit", testName = "ProvisioningManagerTest")
-public class ProvisioningManagerTest {
-
- @Test
- public void testProvision() throws IOException {
- ProvisioningManager manager = new ProvisioningManager();
- AtomicInteger completedJobs = new AtomicInteger(0);
-
- try {
- for (int i = 0; i < 5; i++) {
- manager.provision(new MockJob(200, "slow", completedJobs));
- manager.provision(new MockJob(0, "fast", completedJobs));
- manager.provision(new MockJob(100, "normal", completedJobs));
- }
- } finally {
- manager.close();
- }
-
- assertEquals(completedJobs.get(), 15);
- }
-
- @Test
- public void testProvisionInterrupted() {
- ProvisioningManager manager = new ProvisioningManager();
- AtomicInteger completedJobs = new AtomicInteger(0);
-
- manager.provision(new ShutdownExecutorJob(manager, completedJobs));
- manager.provision(new MockJob(0, "rejected", completedJobs));
-
- assertEquals(completedJobs.get(), 1);
- }
-
- private static class MockJob extends ProvisioningJob {
-
- private final long delay;
- private final AtomicInteger completedJobs;
-
- public MockJob(long delay, String group, AtomicInteger completedJobs) {
- super(sleepPredicate(delay), group, Suppliers.ofInstance((Object) 0));
- this.delay = delay;
- this.completedJobs = completedJobs;
- }
-
- @Override
- public Integer call() throws Exception {
- getAnonymousLogger().info("ProvisioningManagerTest: Starting " + this);
- super.call();
- getAnonymousLogger().info("ProvisioningManagerTest: Completed " + this);
- return completedJobs.incrementAndGet();
- }
-
- @Override
- public String toString() {
- return "MockJob [id=" + hashCode() + ", group=" + getGroup() + ", delay=" + delay + "]";
- }
- }
-
- private static class ShutdownExecutorJob extends ProvisioningJob {
-
- public ShutdownExecutorJob(final ProvisioningManager manager, final AtomicInteger completedJobs) {
- super(Predicates.<String>alwaysTrue(), "shutdown", new Supplier<Object>() {
- @Override
- public Integer get() {
- try {
- manager.close();
- return completedJobs.incrementAndGet();
- } catch (IOException ex) {
- throw Throwables.propagate(ex);
- }
- }
- });
- }
- }
-
- private static Predicate<String> sleepPredicate(final long delay) {
- return new Predicate<String>() {
- @Override
- public boolean apply(String input) {
- sleepUninterruptibly(delay, TimeUnit.MILLISECONDS);
- return true;
- }
- };
- }
-}