protected static void assertStatusWithUser1(String clusterId, Cluster.Status status, ClusterJob.Status actionStatus, ClusterAction action, int totalSteps, int completeSteps) throws Exception { // by default uses user1 assertStatus(clusterId, status, actionStatus, action, totalSteps, completeSteps, USER1_HEADERS); }
public static Registry<ConnectionSocketFactory> getSimpleRegistry() throws NoSuchAlgorithmException, KeyManagementException { return getRegistry(null, null, null, null); }
private List<JsonObject> getNodes(final Header[] headers) throws Exception { HttpResponse response = doGetExternalAPI("/nodes", headers); assertResponseStatus(response, HttpResponseStatus.OK); return getJsonListFromResponse(response); }
private JsonObject getNode(final Header[] headers, final String nodeId) throws Exception { HttpResponse response = doGetExternalAPI("/nodes/" + nodeId, headers); assertResponseStatus(response, HttpResponseStatus.OK); return getJsonObjectFromResponse(response); }
private List<Node> postNodes(int numberOfNodes, Header[] headers) throws Exception { List<Node> nodes = createNodes(numberOfNodes); for (Node node : nodes) { HttpResponse response = doPostExternalAPI("/nodes", gson.toJson(node), headers); assertResponseStatus(response, HttpResponseStatus.CREATED); } return nodes; }
protected static List<JsonObject> getJsonListFromResponse(HttpResponse response) throws IOException { Reader reader = getInputStreamReaderFromResponse(response); List<JsonObject> result = gson.fromJson(reader, new TypeToken<List<JsonObject>>() {}.getType()); reader.close(); return result; }
@AfterClass public static void cleanupServiceBase() { internalHandlerServer.stopAndWait(); externalHandlerServer.stopAndWait(); }
@Test public void testDeleteSuperadminForbidden() throws Exception { assertResponseStatus(doDeleteExternalAPI("/tenants/" + Constants.SUPERADMIN_TENANT, SUPERADMIN_HEADERS), HttpResponseStatus.FORBIDDEN); }
private void assertImport(Map<String, JsonElement> import1, Map<String, JsonElement> export1, String key) { if (!import1.containsKey(key)) { return; } Assert.assertEquals(gson.fromJson(import1.get(key), new TypeToken<Set<?>>() { }.getType()), gson.fromJson(export1.get(key), new TypeToken<Set<?>>() { }.getType())); }
public static HttpResponse doPutInternalAPI(String resource, String body) throws Exception { return doPut(resource, body, null, internalBase); }
public static HttpResponse doGetExternalAPI(String resource, Header[] headers) throws Exception { return doGet(resource, headers, externalBase); }
public static HttpResponse doPostInternalAPI(String resource, String body) throws Exception { return doPost(resource, body, null, internalBase); }
public static HttpResponse doGetWithoutVersionExternalAPI(String resource) throws Exception { return doGetWithoutVersion(resource, externalPort); }
public static HttpResponse doDeleteExternalAPI(String resource, Header[] headers) throws Exception { return doDelete(resource, headers, externalBase); }
public static String getBaseUrlInternalAPI() { return getBaseUrl(internalPort); }
private void assertSendContents(String contents, PluginType type, String pluginName, String resourceType, String resourceName) throws Exception { assertSendContents(contents, new ResourceType(type, pluginName, resourceType), resourceName); }
public static HttpResponse doPutExternalAPI(String resource, String body, Header[] headers) throws Exception { return doPut(resource, body, headers, externalBase); }
public static HttpResponse doGetInternalAPI(String resource) throws Exception { return doGet(resource, null, internalBase); }
public static HttpResponse doPostExternalAPI(String resource, String body, Header[] headers) throws Exception { return doPost(resource, body, headers, externalBase); }
public static HttpResponse doPutInternalAPI(String resource, String body, Header[] headers) throws Exception { return doPut(resource, body, headers, internalBase); }