mirror of https://github.com/apache/jclouds.git
Added assertion for versioned OpenStack extension APIs. Required for the Neutron v2 API.
This commit is contained in:
parent
60e3763999
commit
ddd00a20de
|
@ -133,7 +133,7 @@ public class BaseOpenStackMockTest<A extends Closeable> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a string from a resource
|
* Get a string from a resource
|
||||||
*
|
*
|
||||||
* @param resourceName
|
* @param resourceName
|
||||||
* The name of the resource.
|
* The name of the resource.
|
||||||
* @return The content of the resource
|
* @return The content of the resource
|
||||||
|
@ -157,14 +157,23 @@ public class BaseOpenStackMockTest<A extends Closeable> {
|
||||||
Throwables.propagate(e);
|
Throwables.propagate(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures server received authentication request.
|
* Ensures server received an extensions request. Most OpenStack APIs that expose an {@link ExtensionApi}
|
||||||
|
* should use this method.
|
||||||
*/
|
*/
|
||||||
public void assertExtensions(MockWebServer server) {
|
public void assertExtensions(MockWebServer server) {
|
||||||
|
assertExtensions(server, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensures server received a <i>versioned</i> extensions request. This is necessary for testing APIs whose version
|
||||||
|
* is not included in the Endpoint's {@link Endpoint#getPublicURL() publicURL}.
|
||||||
|
*/
|
||||||
|
public void assertExtensions(MockWebServer server, String path) {
|
||||||
assertTrue(server.getRequestCount() >= 1);
|
assertTrue(server.getRequestCount() >= 1);
|
||||||
try {
|
try {
|
||||||
assertEquals(server.takeRequest().getRequestLine(), "GET /extensions HTTP/1.1");
|
assertEquals(server.takeRequest().getRequestLine(), "GET " + path + "/extensions HTTP/1.1");
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Throwables.propagate(e);
|
Throwables.propagate(e);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +181,7 @@ public class BaseOpenStackMockTest<A extends Closeable> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures the request has a json header.
|
* Ensures the request has a json header.
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @see RecordedRequest
|
* @see RecordedRequest
|
||||||
*/
|
*/
|
||||||
|
@ -182,7 +191,7 @@ public class BaseOpenStackMockTest<A extends Closeable> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures the request has a json header for the proper REST methods.
|
* Ensures the request has a json header for the proper REST methods.
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param method
|
* @param method
|
||||||
* The request method (such as GET).
|
* The request method (such as GET).
|
||||||
|
@ -198,7 +207,7 @@ public class BaseOpenStackMockTest<A extends Closeable> {
|
||||||
/**
|
/**
|
||||||
* Ensures the request is json and has the same contents as the resource
|
* Ensures the request is json and has the same contents as the resource
|
||||||
* file provided.
|
* file provided.
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param method
|
* @param method
|
||||||
* The request method (such as GET).
|
* The request method (such as GET).
|
||||||
|
|
Loading…
Reference in New Issue