GlacierClientMockTest was growing uncontrollably. This commit
is an attempt to fix this problem.

- The first measure taken moves the duplicated strings to constants
  and the JSON response bodies to resource files. In addition, some
  repeated code was moved to static classes, where they can be reused.

- The second measure taken to address this problem takes advantage
  of Guice's AOP features:

  A MockTestInterceptor has been made. this interceptor intercepts
  test methods annotated with @MockTest and opens a MockWebServer
  for them. The interceptor also initializes a GlacierClient
  pointing to the server URL. When the method ends, the server
  shuts down.

  To configure the module, we make use of the @Guice annotation
  supported by testng.
You can merge this Pull Request by running:

  git pull https://github.com/rcoedo/jclouds-labs-aws cleanup

Or you can view, comment on it, or merge it online at:

  https://github.com/jclouds/jclouds-labs-aws/pull/17

-- Commit Summary --

  * JCLOUDS-457: Clean up for GlacierClientMockTest.

-- File Changes --

    M glacier/src/test/java/org/jclouds/glacier/GlacierClientMockTest.java (307)
    A glacier/src/test/java/org/jclouds/glacier/MockTest.java (26)
    A glacier/src/test/java/org/jclouds/glacier/config/InterceptionModule.java 
(34)
    A 
glacier/src/test/java/org/jclouds/glacier/interceptors/MockTestInterceptor.java 
(65)
    D glacier/src/test/resources/META-INF/services/org.jclouds.apis.ApiMetadata 
(1)
    A glacier/src/test/resources/json/describeVaultResponseBody.json (8)
    A glacier/src/test/resources/json/listVaultsResponseBody.json (29)
    A 
glacier/src/test/resources/json/listVaultsWithQueryParamsResponseBody.json (21)

-- Patch Links --

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

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

Reply via email to