You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2018/01/21 21:08:24 UTC
qpid-broker-j git commit: QPID-8083 [System Tests] [REST/HTTP] Create
empty HTTP system test suite
Repository: qpid-broker-j
Updated Branches:
refs/heads/master b4ba6158f -> f1322a658
QPID-8083 [System Tests] [REST/HTTP] Create empty HTTP system test suite
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/f1322a65
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/f1322a65
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/f1322a65
Branch: refs/heads/master
Commit: f1322a6589a886a2c8378c5148f6f811af4e89c4
Parents: b4ba615
Author: Keith Wall <kw...@apache.org>
Authored: Sun Jan 21 14:30:26 2018 +0000
Committer: Keith Wall <kw...@apache.org>
Committed: Sun Jan 21 16:10:48 2018 +0000
----------------------------------------------------------------------
pom.xml | 1 +
systests/qpid-systests-http-management/pom.xml | 127 +++++++
.../apache/qpid/tests/rest/RestTestHelper.java | 362 +++++++++++++++++++
.../resources/config-http-management-tests.json | 88 +++++
.../apache/qpid/tests/rest/BrokerRestTest.java | 51 +++
.../apache/qpid/tests/utils/BrokerAdmin.java | 3 +-
6 files changed, 631 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f1322a65/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index aa82bf0..dadc1c6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -196,6 +196,7 @@
<module>systests/qpid-systests-jms-core</module>
<module>systests/qpid-systests-jms_1.1</module>
<module>systests/qpid-systests-jms_2.0</module>
+ <module>systests/qpid-systests-http-management</module>
<module>systests/protocol-tests-core</module>
<module>systests/protocol-tests-amqp-0-8</module>
<module>systests/protocol-tests-amqp-0-10</module>
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f1322a65/systests/qpid-systests-http-management/pom.xml
----------------------------------------------------------------------
diff --git a/systests/qpid-systests-http-management/pom.xml b/systests/qpid-systests-http-management/pom.xml
new file mode 100644
index 0000000..c0e29bb
--- /dev/null
+++ b/systests/qpid-systests-http-management/pom.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ ~
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-systests-parent</artifactId>
+ <version>7.1.0-SNAPSHOT</version>
+ <relativePath>../../qpid-systests-parent/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>qpid-systests-http</artifactId>
+ <name>Apache Qpid Broker-J HTTP system tests</name>
+ <description>Apache Qpid Broker-J HTTP system tests</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-broker-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-broker-plugins-amqp-1-0-protocol</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-broker-plugins-amqp-0-8-protocol</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-broker-plugins-amqp-0-10-protocol</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-test-utils</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-systests-utils</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-broker-plugins-logging-logback</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-broker-plugins-memory-store</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-broker-plugins-management-http</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-broker-plugins-derby-store</artifactId>
+ <optional>true</optional>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-bdbstore</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-library</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-integration</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <qpid.initialConfigurationLocation>classpath:config-http-management-tests.json</qpid.initialConfigurationLocation>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f1322a65/systests/qpid-systests-http-management/src/main/java/org/apache/qpid/tests/rest/RestTestHelper.java
----------------------------------------------------------------------
diff --git a/systests/qpid-systests-http-management/src/main/java/org/apache/qpid/tests/rest/RestTestHelper.java b/systests/qpid-systests-http-management/src/main/java/org/apache/qpid/tests/rest/RestTestHelper.java
new file mode 100644
index 0000000..e71da86
--- /dev/null
+++ b/systests/qpid-systests-http-management/src/main/java/org/apache/qpid/tests/rest/RestTestHelper.java
@@ -0,0 +1,362 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.tests.rest;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.DatatypeConverter;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Assert;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.qpid.tests.utils.BrokerAdmin;
+
+public class RestTestHelper
+{
+ private static final Logger LOGGER = LoggerFactory.getLogger(RestTestHelper.class);
+
+ private static final TypeReference<List<LinkedHashMap<String, Object>>> TYPE_LIST_OF_LINKED_HASH_MAPS = new TypeReference<List<LinkedHashMap<String, Object>>>()
+ {
+ };
+ private static final TypeReference<LinkedHashMap<String, Object>> TYPE_LINKED_HASH_MAPS = new TypeReference<LinkedHashMap<String, Object>>()
+ {
+ };
+
+ private static final String API_BASE = "/api/latest/";
+ private final BrokerAdmin _admin;
+ private final int _httpPort;
+ private final String _username;
+ private final String _password;
+
+ private final int _connectTimeout = Integer.getInteger("qpid.resttest_connection_timeout", 30000);
+
+ private String _acceptEncoding;
+ private boolean _useSsl = false;
+
+ public RestTestHelper(BrokerAdmin admin)
+ {
+ _admin = admin;
+ _httpPort = _admin.getBrokerAddress(BrokerAdmin.PortType.HTTP).getPort();
+ _username = admin.getValidUsername();
+ _password = admin.getValidPassword();
+ }
+
+ public int getHttpPort()
+ {
+ return _httpPort;
+ }
+
+ private String getHostName()
+ {
+ return "localhost";
+ }
+
+ private String getProtocol()
+ {
+ return _useSsl ? "https" : "http";
+ }
+
+ public String getManagementURL()
+ {
+ return getProtocol() + "://" + getHostName() + ":" + getHttpPort();
+ }
+
+ public URL getManagementURL(String path) throws MalformedURLException
+ {
+ return new URL(getManagementURL() + path);
+ }
+
+ public HttpURLConnection openManagementConnection(String path, String method) throws IOException
+ {
+ if (!path.startsWith("/"))
+ {
+ path = API_BASE + path;
+ }
+ URL url = getManagementURL(path);
+ HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
+ httpCon.setConnectTimeout(_connectTimeout);
+
+
+ if(_username != null)
+ {
+ String encoded = DatatypeConverter.printBase64Binary((_username + ":" + _password).getBytes(UTF_8));
+ httpCon.setRequestProperty("Authorization", "Basic " + encoded);
+ }
+
+ if (_acceptEncoding != null && !"".equals(_acceptEncoding))
+ {
+ httpCon.setRequestProperty("Accept-Encoding", _acceptEncoding);
+ }
+
+ httpCon.setDoOutput(true);
+ httpCon.setRequestMethod(method);
+ return httpCon;
+ }
+
+ public List<Map<String, Object>> readJsonResponseAsList(HttpURLConnection connection) throws IOException
+ {
+ byte[] data = readConnectionInputStream(connection);
+ ObjectMapper mapper = new ObjectMapper();
+ List<Map<String, Object>> providedObject = mapper.readValue(new ByteArrayInputStream(data), TYPE_LIST_OF_LINKED_HASH_MAPS);
+ return providedObject;
+ }
+
+ public Map<String, Object> readJsonResponseAsMap(HttpURLConnection connection) throws IOException
+ {
+ byte[] data = readConnectionInputStream(connection);
+
+ ObjectMapper mapper = new ObjectMapper();
+ Map<String, Object> providedObject = mapper.readValue(new ByteArrayInputStream(data), TYPE_LINKED_HASH_MAPS);
+ return providedObject;
+ }
+
+ public <T> T readJsonResponse(HttpURLConnection connection, Class<T> valueType) throws IOException
+ {
+ byte[] data = readConnectionInputStream(connection);
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ return mapper.readValue(new ByteArrayInputStream(data), valueType);
+ }
+
+ private byte[] readConnectionInputStream(HttpURLConnection connection) throws IOException
+ {
+ InputStream is = connection.getInputStream();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = -1;
+ while ((len = is.read(buffer)) != -1)
+ {
+ baos.write(buffer, 0, len);
+ }
+ if (LOGGER.isTraceEnabled())
+ {
+ LOGGER.trace("RESPONSE:" + new String(baos.toByteArray(), UTF_8));
+ }
+ return baos.toByteArray();
+ }
+
+ private void writeJsonRequest(HttpURLConnection connection, Object data) throws IOException
+ {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.writeValue(connection.getOutputStream(), data);
+ }
+
+ public Map<String, Object> find(String name, Object value, List<Map<String, Object>> data)
+ {
+ if (data == null)
+ {
+ return null;
+ }
+
+ for (Map<String, Object> map : data)
+ {
+ Object mapValue = map.get(name);
+ if (value.equals(mapValue))
+ {
+ return map;
+ }
+ }
+ return null;
+ }
+
+ public Map<String, Object> find(Map<String, Object> searchAttributes, List<Map<String, Object>> data)
+ {
+ for (Map<String, Object> map : data)
+ {
+ boolean equals = true;
+ for (Map.Entry<String, Object> entry : searchAttributes.entrySet())
+ {
+ Object mapValue = map.get(entry.getKey());
+ if (!entry.getValue().equals(mapValue))
+ {
+ equals = false;
+ break;
+ }
+ }
+ if (equals)
+ {
+ return map;
+ }
+ }
+ return null;
+ }
+
+ public Map<String, Object> getJsonAsSingletonList(String path) throws IOException
+ {
+ List<Map<String, Object>> response = getJsonAsList(path);
+
+ Assert.assertNotNull("Response cannot be null", response);
+ Assert.assertEquals("Unexpected response from " + path, 1, response.size());
+ return response.get(0);
+ }
+
+ public Map<String, Object> postDataToPathAndGetObject(String path, Map<String, Object> data) throws IOException
+ {
+ HttpURLConnection connection = openManagementConnection(path, "POST");
+ connection.connect();
+ writeJsonRequest(connection, data);
+ Map<String, Object> response = readJsonResponseAsMap(connection);
+ return response;
+ }
+
+ public List<Map<String, Object>> getJsonAsList(String path) throws IOException
+ {
+ HttpURLConnection connection = openManagementConnection(path, "GET");
+ connection.connect();
+ List<Map<String, Object>> response = readJsonResponseAsList(connection);
+ return response;
+ }
+
+ public List<Object> getJsonAsSimpleList(String path) throws IOException
+ {
+ HttpURLConnection connection = openManagementConnection(path, "GET");
+ connection.connect();
+ byte[] data = readConnectionInputStream(connection);
+ ObjectMapper mapper = new ObjectMapper();
+ List<Object> providedObject = mapper.readValue(new ByteArrayInputStream(data), new TypeReference<List<Object>>()
+ {
+ });
+ return providedObject;
+ }
+
+ public Map<String, Object> getJsonAsMap(String path) throws IOException
+ {
+ HttpURLConnection connection = openManagementConnection(path, "GET");
+ connection.connect();
+ Map<String, Object> response = readJsonResponseAsMap(connection);
+ return response;
+ }
+
+ public <T> T getJson(String path, final Class<T> valueType) throws IOException
+ {
+ HttpURLConnection connection = openManagementConnection(path, "GET");
+ connection.connect();
+ return readJsonResponse(connection, valueType);
+ }
+
+ public <T> T postJson(String path, final Object data , final Class<T> valueType) throws IOException
+ {
+ HttpURLConnection connection = openManagementConnection(path, "POST");
+ connection.connect();
+ writeJsonRequest(connection, data);
+ return readJsonResponse(connection, valueType);
+ }
+
+
+ public int submitRequest(String url, String method, Object data) throws IOException
+ {
+ return submitRequest(url, method, data, null);
+ }
+
+ public int submitRequest(String url, String method, Object data, Map<String, List<String>> responseHeadersToCapture) throws IOException
+ {
+ HttpURLConnection connection = openManagementConnection(url, method);
+ if (data != null)
+ {
+ writeJsonRequest(connection, data);
+ }
+ int responseCode = connection.getResponseCode();
+ if (responseHeadersToCapture!= null)
+ {
+ responseHeadersToCapture.putAll(connection.getHeaderFields());
+ }
+ connection.disconnect();
+ return responseCode;
+ }
+
+ public int submitRequest(String url, String method) throws IOException
+ {
+ return submitRequest(url, method, (byte[])null);
+ }
+
+ public void submitRequest(String url, String method, Object data, int expectedResponseCode) throws IOException
+ {
+ Map<String, List<String>> headers = new HashMap<>();
+ int responseCode = submitRequest(url, method, data, headers);
+ Assert.assertEquals("Unexpected response code from " + method + " " + url , expectedResponseCode, responseCode);
+ if (expectedResponseCode == 201)
+ {
+ List<String> location = headers.get("Location");
+ Assert.assertTrue("Location is not returned by REST create request", location != null && location.size() == 1);
+ }
+ }
+
+ public void submitRequest(String url, String method, int expectedResponseCode) throws IOException
+ {
+ submitRequest(url, method, null, expectedResponseCode);
+ }
+
+ public int submitRequest(String url, String method, byte[] parameters) throws IOException
+ {
+ HttpURLConnection connection = openManagementConnection(url, method);
+ if (parameters != null)
+ {
+ OutputStream os = connection.getOutputStream();
+ os.write(parameters);
+ os.flush();
+ }
+ int responseCode = connection.getResponseCode();
+ connection.disconnect();
+ return responseCode;
+ }
+
+ public byte[] getBytes(String path) throws IOException
+ {
+ HttpURLConnection connection = openManagementConnection(path, "GET");
+ connection.connect();
+ return readConnectionInputStream(connection);
+ }
+
+ public String encode(String value, String encoding) throws UnsupportedEncodingException
+ {
+ return URLEncoder.encode(value, encoding).replace("+", "%20");
+ }
+
+ public String getAcceptEncoding()
+ {
+ return _acceptEncoding;
+ }
+
+ public void setAcceptEncoding(String acceptEncoding)
+ {
+ _acceptEncoding = acceptEncoding;
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f1322a65/systests/qpid-systests-http-management/src/main/resources/config-http-management-tests.json
----------------------------------------------------------------------
diff --git a/systests/qpid-systests-http-management/src/main/resources/config-http-management-tests.json b/systests/qpid-systests-http-management/src/main/resources/config-http-management-tests.json
new file mode 100644
index 0000000..ca8922d
--- /dev/null
+++ b/systests/qpid-systests-http-management/src/main/resources/config-http-management-tests.json
@@ -0,0 +1,88 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+{
+ "name" : "${broker.name}",
+ "modelVersion" : "7.0",
+ "authenticationproviders" : [ {
+ "name" : "anon",
+ "type" : "Anonymous"
+ }, {
+ "name" : "plain",
+ "type" : "Plain",
+ "secureOnlyMechanisms" : [],
+ "users" : [ {
+ "name" : "admin",
+ "type" : "managed",
+ "password" : "admin"
+ }, {
+ "name" : "guest",
+ "type" : "managed",
+ "password" : "guest"
+ } ]
+ } ],
+ "ports" : [ {
+ "name" : "AMQP",
+ "type" : "AMQP",
+ "authenticationProvider" : "plain",
+ "port" : "0",
+ "virtualhostaliases" : [ {
+ "name" : "defaultAlias",
+ "type" : "defaultAlias"
+ }, {
+ "name" : "hostnameAlias",
+ "type" : "hostnameAlias"
+ }, {
+ "name" : "nameAlias",
+ "type" : "nameAlias"
+ } ]
+ }, {
+ "name" : "ANONYMOUS_AMQP",
+ "type" : "AMQP",
+ "authenticationProvider" : "anon",
+ "port" : "0",
+ "virtualhostaliases" : [ {
+ "name" : "defaultAlias",
+ "type" : "defaultAlias",
+ "durable" : true
+ }, {
+ "name" : "hostnameAlias",
+ "type" : "hostnameAlias",
+ "durable" : true
+ }, {
+ "name" : "nameAlias",
+ "type" : "nameAlias",
+ "durable" : true
+ } ]
+ }, {
+ "name": "HTTP",
+ "authenticationProvider": "plain",
+ "port": "0",
+ "protocols": [
+ "HTTP"
+ ]
+ }],
+ "plugins" : [ {
+ "type" : "MANAGEMENT-HTTP",
+ "name" : "httpManagement",
+ "httpBasicAuthenticationEnabled" : true
+ } ],
+ "virtualhostnodes" : []
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f1322a65/systests/qpid-systests-http-management/src/test/java/org/apache/qpid/tests/rest/BrokerRestTest.java
----------------------------------------------------------------------
diff --git a/systests/qpid-systests-http-management/src/test/java/org/apache/qpid/tests/rest/BrokerRestTest.java b/systests/qpid-systests-http-management/src/test/java/org/apache/qpid/tests/rest/BrokerRestTest.java
new file mode 100644
index 0000000..91d88c0
--- /dev/null
+++ b/systests/qpid-systests-http-management/src/test/java/org/apache/qpid/tests/rest/BrokerRestTest.java
@@ -0,0 +1,51 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.tests.rest;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.tests.utils.BrokerAdminUsingTestBase;
+
+public class BrokerRestTest extends BrokerAdminUsingTestBase
+{
+ private RestTestHelper _helper;
+
+ @Before
+ public void setUp()
+ {
+ _helper = new RestTestHelper(getBrokerAdmin());
+ }
+
+ @Test
+ public void get() throws Exception
+ {
+ Map<String, Object> brokerDetails = _helper.getJsonAsMap("broker");
+ assertThat("Unexpected value of attribute " + Broker.NAME, brokerDetails.get(Broker.NAME), is(equalTo("Broker")));
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f1322a65/systests/systests-utils/src/main/java/org/apache/qpid/tests/utils/BrokerAdmin.java
----------------------------------------------------------------------
diff --git a/systests/systests-utils/src/main/java/org/apache/qpid/tests/utils/BrokerAdmin.java b/systests/systests-utils/src/main/java/org/apache/qpid/tests/utils/BrokerAdmin.java
index 3b57431..3ec35ad 100644
--- a/systests/systests-utils/src/main/java/org/apache/qpid/tests/utils/BrokerAdmin.java
+++ b/systests/systests-utils/src/main/java/org/apache/qpid/tests/utils/BrokerAdmin.java
@@ -62,6 +62,7 @@ public interface BrokerAdmin extends Pluggable
{
ANONYMOUS_AMQP,
ANONYMOUS_AMQPWS,
- AMQP
+ AMQP,
+ HTTP
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org