> +
> +      FirewallOptions options = new FirewallOptions()
> +         .name("myfw")
> +         .network(URI.create(url("/projects/party/global/networks/default")))
> +         .addAllowedRule(Firewall.Rule.create("tcp", ImmutableList.of("22", 
> "23-24")))
> +         .addSourceTag("tag1")
> +         .addSourceRange("10.0.1.0/32")
> +         .addTargetTag("tag2");
> +
> +      assertEquals(firewallApi().update("myfw", options),
> +            new ParseOperationTest().expected(url("/projects")));
> +
> +      assertSent(server, "PUT", "/projects/party/global/firewalls/myfw",
> +            stringFromResource("/firewall_insert.json"));
> +   }
> +
>     FirewallApi firewallApi(){
>        return api().firewalls();
>     }

I've seen this class still exists to test the `PATCH` method. Mock tests should 
also support it. In fact, as opposed to *expect* tests, mock tests perform 
*real* requests against a mocked backend, so we could say that if a Mock test 
doesn't work, the API does not work.

In order to bypass the limitation of the default JRE HttpUrlConnection 
implementation that does not support PATCH requests with a body, could you 
configure the tests to use the [OkHttp 
driver](https://github.com/jclouds/jclouds/tree/master/drivers/okhttp)? It 
should be as easy as just adding the `OkHttpCommandExecutorServiceModule` 
module to the set of modules in the `BaseGoogleComputeEngineApiMockTest` class. 
Could you give it a try? If it works we should also consider configuring the 
OkHttp driver as the default HTTP driver for GCE, to make sure all the methods 
work out of the box.

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

Reply via email to