You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Christopher Dancy <no...@github.com> on 2014/06/12 17:52:03 UTC
[jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Issue can be found in JIRA here: https://issues.apache.org/jira/browse/JCLOUDS-596
You can merge this Pull Request by running:
git pull https://github.com/cdancy/jclouds master
Or you can view, comment on it, or merge it online at:
https://github.com/jclouds/jclouds/pull/405
-- Commit Summary --
* NodePredicates gained static predicate SUSPENDED
-- File Changes --
M compute/src/main/java/org/jclouds/compute/predicates/NodePredicates.java (15)
-- Patch Links --
https://github.com/jclouds/jclouds/pull/405.patch
https://github.com/jclouds/jclouds/pull/405.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Christopher Dancy <no...@github.com>.
> @@ -267,7 +267,22 @@ public boolean apply(NodeMetadata nodeMetadata) {
>
> @Override
> public String toString() {
> - return "TERMINATED";
> + return Status.TERMINATED.toString();
> + }
> + };
> +
> + /**
> + * Match nodes with State == SUSPENDED
> + */
> + public static final Predicate<NodeMetadata> SUSPENDED = new Predicate<NodeMetadata>() {
We are using it here locally (rackspace/openstack) to test if a set of VM's is up or down. Only made sense to push it back upstream.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405/files#r13749452
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #888](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/888/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46052281
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #1353](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/1353/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45916178
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #886](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/886/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46032201
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #1355](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/1355/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45948992
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #881](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/881/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45914352
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Christopher Dancy <no...@github.com>.
> @@ -141,6 +141,19 @@ public void testNodeRunningReturnsTrueWhenRunning() {
> Assert.assertTrue(nodeRunning.apply(reference));
> Assert.assertEquals(reference.get(), node);
> }
> +
> + @Test
> + public void testNodeSuspendedReturnsTrueWhenSuspended() {
> + expect(node.getStatus()).andReturn(Status.SUSPENDED).atLeastOnce();
> + expect(node.getBackendStatus()).andReturn(null).atLeastOnce();
> + replay(node);
> + replay(computeService);
All testers in this class were doing the same thing (not written by me). I've changed all to use the method you noted above. Good catch.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405/files#r13750731
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #887](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/887/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46053176
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #1352](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/1352/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45915689
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #889](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/889/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46056459
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1224](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1224/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46059613
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #883](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/883/) UNSTABLE
Looks like there's a problem with this pull request
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45938634
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Andrew Phillips <no...@github.com>.
Congrats, @cdancy! Thanks for contributing!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46261756
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #884](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/884/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45948778
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #1356](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/1356/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46016952
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Christopher Dancy <no...@github.com>.
Added second commit to remove hard-coded strings inside NodePredicates.<name>.toString methods which is just asking for a typo to pop. Replaced hard-coded strings by calling their respective enum.toString() methods.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45913524
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #885](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/885/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46016797
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1218](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1218/) UNSTABLE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45941664
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #1357](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/1357/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46031405
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #1354](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/1354/) UNSTABLE
Looks like there's a problem with this pull request
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45938773
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Everett Toews <no...@github.com>.
Merged to master and 1.7.x
@cdancy Thanks for the contribution! This is your first commit right?
We'd love to give you a shout out on Twitter if you're okay with that. What's your Twitter username?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46243988
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1219](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1219/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45950584
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Christopher Dancy <no...@github.com>.
This was due to a misunderstanding, and lack of testing locally, for a code block I assumed was fairly straight forward. Test passes locally and NOW should be good to go ;)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45944766
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1223](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1223/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46054693
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #1360](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/1360/) UNSTABLE
Looks like there's a problem with this pull request
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46054837
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Andrew Phillips <no...@github.com>.
Thanks for the explanations and updates, @cdancy! Pending a squash'n'rebase, +1 - looks good to go for me.
Cleanups like remove the (unnecessary, if you ask me) `Assert.assertEquals(reference.get(), node);` assertions we can address in another PR, if desired.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46014940
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #1358](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/1358/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46055512
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #1359](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/1359/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46053642
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Christopher Dancy <no...@github.com>.
Rebase/squash is done. Should be good to go. Let me know if there is anything you guys need and/or how it looks. As I mentioned elsewhere: this is my first time working with git so I may have fudged something up.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46049860
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Andrew Phillips <no...@github.com>.
> @@ -141,6 +141,19 @@ public void testNodeRunningReturnsTrueWhenRunning() {
> Assert.assertTrue(nodeRunning.apply(reference));
> Assert.assertEquals(reference.get(), node);
> }
> +
> + @Test
> + public void testNodeSuspendedReturnsTrueWhenSuspended() {
> + expect(node.getStatus()).andReturn(Status.SUSPENDED).atLeastOnce();
> + expect(node.getBackendStatus()).andReturn(null).atLeastOnce();
> + replay(node);
> + replay(computeService);
[minor] `replay(node, computeService);`?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405/files#r13737155
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1222](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1222/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46033457
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Everett Toews <no...@github.com>.
+1
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45952583
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Christopher Dancy <no...@github.com>.
> @@ -141,6 +141,19 @@ public void testNodeRunningReturnsTrueWhenRunning() {
> Assert.assertTrue(nodeRunning.apply(reference));
> Assert.assertEquals(reference.get(), node);
> }
> +
> + @Test
> + public void testNodeSuspendedReturnsTrueWhenSuspended() {
> + expect(node.getStatus()).andReturn(Status.SUSPENDED).atLeastOnce();
> + expect(node.getBackendStatus()).andReturn(null).atLeastOnce();
> + replay(node);
> + replay(computeService);
> +
> + AtomicNodeSuspended nodeRunning = new AtomicNodeSuspended(computeService);
> + AtomicReference<NodeMetadata> reference = Atomics.newReference(node);
> + Assert.assertTrue(nodeRunning.apply(reference));
> + Assert.assertEquals(reference.get(), node);
Creating a tester for SUSPENDED was recommended by Everett Toews. I basically copied the method definition for 'testNodeRunningReturnsTrueWhenRunning' and massaged it for SUSPENDED. The above minor changes you noted I can make.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405/files#r13749568
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #882](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/882/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45917597
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1217](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1217/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45923556
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Christopher Dancy <no...@github.com>.
This is my first commit but not on twitter. I am however on Facebook here:
https://www.facebook.com/christoforever
and googaplus here:
https://plus.google.com/+ChristopherDancy/posts
Looking forward to contributing more code and thanks for the help.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46254918
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Christopher Dancy <no...@github.com>.
> @@ -141,6 +141,19 @@ public void testNodeRunningReturnsTrueWhenRunning() {
> Assert.assertTrue(nodeRunning.apply(reference));
> Assert.assertEquals(reference.get(), node);
> }
> +
> + @Test
> + public void testNodeSuspendedReturnsTrueWhenSuspended() {
> + expect(node.getStatus()).andReturn(Status.SUSPENDED).atLeastOnce();
> + expect(node.getBackendStatus()).andReturn(null).atLeastOnce();
> + replay(node);
> + replay(computeService);
> +
> + AtomicNodeSuspended nodeRunning = new AtomicNodeSuspended(computeService);
Renamed to 'nodeSuspended'
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405/files#r13750763
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Andrew Phillips <no...@github.com>.
> @@ -141,6 +141,19 @@ public void testNodeRunningReturnsTrueWhenRunning() {
> Assert.assertTrue(nodeRunning.apply(reference));
> Assert.assertEquals(reference.get(), node);
> }
> +
> + @Test
> + public void testNodeSuspendedReturnsTrueWhenSuspended() {
> + expect(node.getStatus()).andReturn(Status.SUSPENDED).atLeastOnce();
> + expect(node.getBackendStatus()).andReturn(null).atLeastOnce();
> + replay(node);
> + replay(computeService);
> +
> + AtomicNodeSuspended nodeRunning = new AtomicNodeSuspended(computeService);
> + AtomicReference<NodeMetadata> reference = Atomics.newReference(node);
> + Assert.assertTrue(nodeRunning.apply(reference));
> + Assert.assertEquals(reference.get(), node);
Please import `assertTrue` and `assertEquals` statically. Also, what is the latter assertion getting us? It seems to just be verifying that, if you create an AtomicReference that refers to x, then x will be returned if you get the reference? We don't need to be testing that in jclouds, I guess?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405/files#r13737168
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Andrew Phillips <no...@github.com>.
> @@ -267,7 +267,22 @@ public boolean apply(NodeMetadata nodeMetadata) {
>
> @Override
> public String toString() {
> - return "TERMINATED";
> + return Status.TERMINATED.toString();
> + }
> + };
> +
> + /**
> + * Match nodes with State == SUSPENDED
> + */
> + public static final Predicate<NodeMetadata> SUSPENDED = new Predicate<NodeMetadata>() {
Out of curiosity...is this used/needed anywhere? Or are we adding it for completeness?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405/files#r13737145
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Everett Toews <no...@github.com>.
Can you please a test or tests for this new predicate to AtomicNodePredicatesTest?
You'll be able to use the tests at the bottom of that class as a template for your test.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45931104
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Christopher Dancy <no...@github.com>.
Should be good to go. Nothing special just copied one of the previous testers that fails when node is not running.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-45936032
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1225](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1225/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46064476
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1221](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1221/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405#issuecomment-46023098
Re: [jclouds] NodePredicates gained static predicate SUSPENDED (#405)
Posted by Andrew Phillips <no...@github.com>.
> @@ -141,6 +141,19 @@ public void testNodeRunningReturnsTrueWhenRunning() {
> Assert.assertTrue(nodeRunning.apply(reference));
> Assert.assertEquals(reference.get(), node);
> }
> +
> + @Test
> + public void testNodeSuspendedReturnsTrueWhenSuspended() {
> + expect(node.getStatus()).andReturn(Status.SUSPENDED).atLeastOnce();
> + expect(node.getBackendStatus()).andReturn(null).atLeastOnce();
> + replay(node);
> + replay(computeService);
> +
> + AtomicNodeSuspended nodeRunning = new AtomicNodeSuspended(computeService);
Rename to "nodeSuspended" or "suspendedNode" or suchlike?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/405/files#r13737173