Re: [jclouds-labs] add docker NetworkAPI (#221)

2015-11-11 Thread Andrea Turli
> +  assertNotNull(network);
> +  assertNotNull(network.id());
> +
> +   }
> +
> +   @Test(dependsOnMethods = "testCreateNetwork")
> +   public void testGetNetwork() {
> +  network = api().inspectNetwork(network.id());
> +  assertNotNull(network);
> +   }
> +
> +   @Test(dependsOnMethods = "testGetNetwork")
> +   public void testAttachContainerToNetwork() {
> +  api().connectContainerToNetwork(network.id(), container.id());
> +  Container foundContainer = 
> api.getContainerApi().inspectContainer(container.id());
> +  
> assertNotNull(Iterables.tryFind(foundContainer.networkSettings().networks().keySet(),
>  Predicates.equalTo(network.name())).orNull());

+1
thanks

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/221/files#r44516836

Re: [jclouds-labs] add docker NetworkAPI (#221)

2015-11-11 Thread Andrea Turli
> +  container = api.getContainerApi().inspectContainer(container.id());
> +   }
> +
> +   @AfterClass
> +   protected void tearDown() {
> +  if (container != null) {
> + api.getContainerApi().stopContainer(container.id());
> + api.getContainerApi().removeContainer(container.id());
> +  }
> +  if (network != null) {
> + api().removeNetwork(network.id());
> +  }
> +   }
> +
> +   public void testCreateNetwork() throws IOException, InterruptedException {
> +  network = api().createNetwork(Network.create(NETWORK_NAME, null, null, 
> null, null, ImmutableMap. of(), 
> ImmutableMap. of()));

Not sure, maybe when I'll add auto value builders things will be easier?
I think there are a bunch of options:
- multiple Network.create() 
- `NetworkCreate` 
- Network.builder(). ... .build() using AutoValue builders
but maybe we should have some sort of guidelines.
wdyt?

Happy to solve it here or in a subsequent PR.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/221/files#r44516823

Re: [jclouds-labs] add docker NetworkAPI (#221)

2015-11-11 Thread Andrea Turli
> +
> +  try {
> + api.removeNetwork(networkId);
> + assertSent(server, "DELETE", "/networks/" + networkId);
> +
> +  } finally {
> + server.shutdown();
> +  }
> +   }
> +
> +   public void testConnectContainerToNetwork() throws Exception {
> +  MockWebServer server = mockWebServer(new 
> MockResponse().setResponseCode(200));
> +  NetworkApi api = api(DockerApi.class, 
> server.getUrl("/").toString()).getNetworkApi();
> +  try {
> + api.connectContainerToNetwork("1", "containerName");
> + assertSent(server, "POST", "/networks/1/connect");

I think I was using `@Produces` annotation in a wrong way as I had to use 
`@Headers` for `Content-Type` so I think it is now better. Sorry for the 
confusion!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/221/files#r44519204

Re: [jclouds-labs] add docker NetworkAPI (#221)

2015-11-11 Thread Andrea Turli
>}
>  
>public Builder fromNetworkSettings(NetworkSettings in) {
>   return 
> this.ipAddress(in.ipAddress()).ipPrefixLen(in.ipPrefixLen()).gateway(in.gateway()).bridge(in.bridge())
> -   .portMapping(in.portMapping()).ports(in.ports());
> +   
> .portMapping(in.portMapping()).ports(in.ports()).sandboxId(in.sandboxId()).hairpinMode(in.hairpinMode()).linkLocalIPv6Address(in
> + 
> .linkLocalIPv6Address()).linkLocalIPv6PrefixLen(in.linkLocalIPv6PrefixLen()).sandboxKey(in.sandboxKey()).secondaryIPAddresses(in
> + 
> .secondaryIPAddresses()).secondaryIPv6Addresses(in.secondaryIPv6Addresses()).endpointId(in.endpointId()).globalIPv6Address(in
> + 
> .globalIPv6Address()).globalIPv6PrefixLen(in.globalIPv6PrefixLen()).ipv6Gateway(in.ipv6Gateway()).macAddress(in.macAddress())
> + .networks(in.networks());

completely agree! Next PRs will use the auto builders

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/221/files#r44516331

Re: [jclouds-labs] add docker NetworkAPI (#221)

2015-11-11 Thread Ignasi Barrera
> +
> +  try {
> + api.removeNetwork(networkId);
> + assertSent(server, "DELETE", "/networks/" + networkId);
> +
> +  } finally {
> + server.shutdown();
> +  }
> +   }
> +
> +   public void testConnectContainerToNetwork() throws Exception {
> +  MockWebServer server = mockWebServer(new 
> MockResponse().setResponseCode(200));
> +  NetworkApi api = api(DockerApi.class, 
> server.getUrl("/").toString()).getNetworkApi();
> +  try {
> + api.connectContainerToNetwork("1", "containerName");
> + assertSent(server, "POST", "/networks/1/connect");

What I mean, is that the call generates a body; not only a requestLine. The 
assertSent should also verify that it is sending the right payload. Take as an 
example the [GCE mock 
tests](https://github.com/jclouds/jclouds/blob/master/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java#L85-L117).
This should be applied to all mock test classes, but let's fix just the network 
mock in this PR.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/221/files#r44520654

Re: [jclouds-labs] add docker NetworkAPI (#221)

2015-11-11 Thread Ignasi Barrera
> +  container = api.getContainerApi().inspectContainer(container.id());
> +   }
> +
> +   @AfterClass
> +   protected void tearDown() {
> +  if (container != null) {
> + api.getContainerApi().stopContainer(container.id());
> + api.getContainerApi().removeContainer(container.id());
> +  }
> +  if (network != null) {
> + api().removeNetwork(network.id());
> +  }
> +   }
> +
> +   public void testCreateNetwork() throws IOException, InterruptedException {
> +  network = api().createNetwork(Network.create(NETWORK_NAME, null, null, 
> null, null, ImmutableMap. of(), 
> ImmutableMap. of()));

+1 to the builders :) let's do that when they are implemented then.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/221/files#r44520373

Re: [jclouds-labs] add docker NetworkAPI (#221)

2015-11-11 Thread Andrea Turli
> +   public void testGetNetwork() {
> +  network = api().inspectNetwork(network.id());
> +  assertNotNull(network);
> +   }
> +
> +   @Test(dependsOnMethods = "testGetNetwork")
> +   public void testAttachContainerToNetwork() {
> +  api().connectContainerToNetwork(network.id(), container.id());
> +  Container foundContainer = 
> api.getContainerApi().inspectContainer(container.id());
> +  
> assertNotNull(Iterables.tryFind(foundContainer.networkSettings().networks().keySet(),
>  Predicates.equalTo(network.name())).orNull());
> +   }
> +
> +   @Test(dependsOnMethods = "testAttachContainerToNetwork")
> +   public void testDisconnectContainerFromNetwork() {
> +  api().disconnectContainerFromNetwork(network.id(), container.id());
> +  // TODO assertion

ops :)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/221/files#r44516620

[jira] [Closed] (JCLOUDS-1036) Image id is not populated in nodes that have not been created by jclouds

2015-11-11 Thread Ignasi Barrera (JIRA)

 [ 
https://issues.apache.org/jira/browse/JCLOUDS-1036?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ignasi Barrera closed JCLOUDS-1036.
---
   Resolution: Duplicate
Fix Version/s: 2.0.0

I've just seen this was already fixed in master.

> Image id is not populated in nodes that have not been created by jclouds
> 
>
> Key: JCLOUDS-1036
> URL: https://issues.apache.org/jira/browse/JCLOUDS-1036
> Project: jclouds
>  Issue Type: Bug
>  Components: jclouds-compute
>Affects Versions: 1.9.1
>Reporter: Ignasi Barrera
>  Labels: google-compute-engine
> Fix For: 2.0.0
>
>
> The {{InstancetoNodeMetadata}} uses a "boot disk -> image" cache that is 
> populated by the compute service adapter when nodes are created.
> When there are existing nodes in the account that were already there, those 
> nodes don't get the image id field populated. In the cases where the cache 
> does not contain a node's boot disk, jclouds should perform the necessary API 
> callls to get the image id.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


Re: [jclouds-labs] add docker NetworkAPI (#221)

2015-11-11 Thread Andrea Turli
Thanks @nacx I think I'm done now, I hope :)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/221#issuecomment-155814158

[jclouds-labs] JCLOUDS-947: Properly configure live tests in ProfitBricks (#222)

2015-11-11 Thread Reijhanniel Jearl Campos
*WIP*. Creating PR for early comments. Ran live test with:

```sh
➜  profitbricks git:(develop) mvn clean install -Plive 
-Dtest.profitbricks.identity= 
-Dtest.profitbricks.credential= 
-Dtest.profitbricks.template=
```
You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds-labs/pull/222

-- Commit Summary --

  * JCLOUDS-947: (WIP) Properly configure live tests in ProfitBricks

-- File Changes --

M 
profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinder.java
 (4)
M 
profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinder.java
 (6)
M 
profitbricks/src/main/java/org/jclouds/profitbricks/compute/config/ProfitBricksComputeServiceContextModule.java
 (93)
D 
profitbricks/src/main/java/org/jclouds/profitbricks/compute/internal/ProvisioningStatusPollingPredicate.java
 (70)
M 
profitbricks/src/main/java/org/jclouds/profitbricks/config/ProfitBricksComputeProperties.java
 (1)
M profitbricks/src/main/java/org/jclouds/profitbricks/domain/Location.java 
(5)
M 
profitbricks/src/main/java/org/jclouds/profitbricks/features/IpBlockApi.java (5)
M 
profitbricks/src/main/java/org/jclouds/profitbricks/features/LoadBalancerApi.java
 (15)
M profitbricks/src/main/java/org/jclouds/profitbricks/features/NicApi.java 
(16)
A 
profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerIdOnlyResponseHandler.java
 (51)
A 
profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/nic/NicIdOnlyResponseHandler.java
 (51)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/BaseProfitBricksLiveTest.java
 (161)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinderTest.java
 (17)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinderTest.java
 (18)
R 
profitbricks/src/test/java/org/jclouds/profitbricks/compute/config/StatusPredicateTest.java
 (62)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/features/DataCenterApiLiveTest.java
 (16)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/features/DrivesApiLiveTest.java
 (64)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/features/FirewallApiLiveTest.java
 (110)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/features/ImageApiLiveTest.java
 (30)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiLiveTest.java
 (63)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiMockTest.java
 (4)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadBalancerApiLiveTest.java
 (127)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadBalancerApiMockTest.java
 (31)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiLiveTest.java
 (104)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiMockTest.java
 (27)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiLiveTest.java
 (71)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiLiveTest.java
 (133)
M 
profitbricks/src/test/java/org/jclouds/profitbricks/features/StorageApiLiveTest.java
 (65)
A 
profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerIdOnlyResponseHandlerTest.java
 (41)
R 
profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/nic/NicIdOnlyResponseHandlerTest.java
 (29)
M profitbricks/src/test/resources/loadbalancer/loadbalancer-create.xml (28)
M profitbricks/src/test/resources/loadbalancer/loadbalancer-deregister.xml 
(26)
M profitbricks/src/test/resources/loadbalancer/loadbalancer-register.xml 
(32)
M profitbricks/src/test/resources/loadbalancer/loadbalancer-update.xml (27)
A profitbricks/src/test/resources/logback-test.xml (74)
M profitbricks/src/test/resources/nic/nic-delete.xml (21)
M profitbricks/src/test/resources/nic/nic-internetaccess.xml (23)
M profitbricks/src/test/resources/nic/nic-update.xml (27)

-- Patch Links --

https://github.com/jclouds/jclouds-labs/pull/222.patch
https://github.com/jclouds/jclouds-labs/pull/222.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/222


[jira] [Created] (JCLOUDS-1036) Image id is not populated in nodes that have not been created by jclouds

2015-11-11 Thread Ignasi Barrera (JIRA)
Ignasi Barrera created JCLOUDS-1036:
---

 Summary: Image id is not populated in nodes that have not been 
created by jclouds
 Key: JCLOUDS-1036
 URL: https://issues.apache.org/jira/browse/JCLOUDS-1036
 Project: jclouds
  Issue Type: Bug
  Components: jclouds-compute
Affects Versions: 1.9.1
Reporter: Ignasi Barrera


The {{InstancetoNodeMetadata}} uses a "boot disk -> image" cache that is 
populated by the compute service adapter when nodes are created.

When there are existing nodes in the account that were already there, those 
nodes don't get the image id field populated. In the cases where the cache does 
not contain a node's boot disk, jclouds should perform the necessary API callls 
to get the image id.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


Re: [jclouds] Fixes tests failing on windows filesystems (#871)

2015-11-11 Thread Zack Shoylev
Closed #871.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/871#event-462017233

Re: [jclouds] Fixes tests failing on windows filesystems (#871)

2015-11-11 Thread Zack Shoylev
merged

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/871#issuecomment-155983551

Build failed in Jenkins: jclouds #3278

2015-11-11 Thread jenkins-no-reply
See 

Changes:

[Zack Shoylev] Fixes tests failing on windows filesystems Makes windows 
behavior more consistent, especially for deletes

--
Started by an SCM change
Building remotely on cdfb07be (lxc-fedora17 standard m1.large large) in 
workspace 
$ sudo /opt/jenkins/sbin/mount-webdav 
https://repository-jclouds.forge.cloudbees.com/private jclouds alert
webdav mount try 1
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 2
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 3
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 4
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 5
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 6
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 7
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 8
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 9
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 10
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 11
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 12
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 13
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 14
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 15
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 16
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 17
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 18
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 19
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 20
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 21
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 22
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 23
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 24
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 25
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 26
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 27
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 28
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 29
/sbin/mount.davfs: Mounting failed.
200 OK
webdav mount try 30
/sbin/mount.davfs: Mounting failed.
200 OK
/opt/jenkins/sbin/mount-webdav: line 31: ohai: command not found
Null message body; hope that's ok
Failed to mount private webdav filestore
Process leaked file descriptors. See 
http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for 
more information
Cloning the remote Git repository
Cloning repository https://git-wip-us.apache.org/repos/asf/jclouds.git
 > git init  # timeout=10
Fetching upstream changes from 
https://git-wip-us.apache.org/repos/asf/jclouds.git
 > git --version # timeout=10
 > git fetch --tags --progress 
 > https://git-wip-us.apache.org/repos/asf/jclouds.git 
 > +refs/heads/*:refs/remotes/origin/*
 > git config remote.origin.url 
 > https://git-wip-us.apache.org/repos/asf/jclouds.git # timeout=10
 > git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # 
 > timeout=10
 > git config remote.origin.url 
 > https://git-wip-us.apache.org/repos/asf/jclouds.git # timeout=10
Fetching upstream changes from 
https://git-wip-us.apache.org/repos/asf/jclouds.git
 > git fetch --tags --progress 
 > https://git-wip-us.apache.org/repos/asf/jclouds.git 
 > +refs/heads/*:refs/remotes/origin/*
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 41ce90ec360a46cb7b03f7cb8b66e01a113aa5b6 
(refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 41ce90ec360a46cb7b03f7cb8b66e01a113aa5b6
 > git rev-list fb63b0ee61a752d6f038e495407e55305c6c9623 # timeout=10
 > git tag -a -f -m Jenkins Build #3278 jenkins-jclouds-3278 # timeout=10
Parsing POMs
ERROR: No such settings file /private/jclouds/settings.xml exists
Please verify that your alternate settings file is specified properly and 
exists in the workspace.
Started calculate disk usage of build
Finished Calculation of disk usage of build in  1 second
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in  1 second


Re: [jclouds] Fixes tests failing on windows filesystems (#871)

2015-11-11 Thread Zack Shoylev
Rebased, will merge and we might address further changes in my next PR (already 
working on it)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/871#issuecomment-155907750