summaryrefslogtreecommitdiff
path: root/qpid/java/broker-plugins/management-http/src/test
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2015-04-15 09:47:28 +0000
committerAlex Rudyy <orudyy@apache.org>2015-04-15 09:47:28 +0000
commit0a0baee45ebcff44635907d457c4ff6810b09c87 (patch)
tree8bfb0f9eddbc23cff88af69be80ab3ce7d47011c /qpid/java/broker-plugins/management-http/src/test
parent54aa3d7070da16ce55c28ccad3f7d0871479e461 (diff)
downloadqpid-python-0a0baee45ebcff44635907d457c4ff6810b09c87.tar.gz
QPID-6481: Move java source tree to top level
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1673693 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/management-http/src/test')
-rw-r--r--qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java117
-rw-r--r--qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/log/LogFileHelperTest.java339
-rw-r--r--qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/ReportRunnerTest.java186
-rw-r--r--qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestBinaryReport.java114
-rw-r--r--qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestTextReport.java84
-rw-r--r--qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java410
-rw-r--r--qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/session/LoginLogoutReporterTest.java84
-rw-r--r--qpid/java/broker-plugins/management-http/src/test/resources/META-INF/services/org.apache.qpid.server.management.plugin.report.QueueReport2
8 files changed, 0 insertions, 1336 deletions
diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java
deleted file mode 100644
index 4031f13655..0000000000
--- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *
- * 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.server.management.plugin;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.qpid.server.configuration.updater.TaskExecutor;
-import org.apache.qpid.server.configuration.updater.TaskExecutorImpl;
-import org.apache.qpid.server.logging.EventLogger;
-import org.apache.qpid.server.model.AuthenticationProvider;
-import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.model.BrokerModel;
-import org.apache.qpid.server.model.ConfiguredObject;
-import org.apache.qpid.server.model.ConfiguredObjectFactory;
-import org.apache.qpid.server.model.ConfiguredObjectFactoryImpl;
-import org.apache.qpid.server.model.State;
-import org.apache.qpid.server.model.port.HttpPort;
-import org.apache.qpid.test.utils.QpidTestCase;
-
-public class HttpManagementTest extends QpidTestCase
-{
- private UUID _id;
- private Broker _broker;
- private HttpManagement _management;
-
- @Override
- public void setUp() throws Exception
- {
- super.setUp();
- _id = UUID.randomUUID();
- _broker = mock(Broker.class);
- ConfiguredObjectFactory objectFactory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
-
- when(_broker.getObjectFactory()).thenReturn(objectFactory);
- when(_broker.getModel()).thenReturn(objectFactory.getModel());
- when(_broker.getCategoryClass()).thenReturn(Broker.class);
- when(_broker.getEventLogger()).thenReturn(mock(EventLogger.class));
- TaskExecutor taskExecutor = new TaskExecutorImpl();
- taskExecutor.start();
- when(_broker.getTaskExecutor()).thenReturn(taskExecutor);
- when(_broker.getChildExecutor()).thenReturn(taskExecutor);
-
-
- Map<String, Object> attributes = new HashMap<String, Object>();
- attributes.put(HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, false);
- attributes.put(HttpManagement.HTTPS_BASIC_AUTHENTICATION_ENABLED, true);
- attributes.put(HttpManagement.HTTP_SASL_AUTHENTICATION_ENABLED, false);
- attributes.put(HttpManagement.HTTPS_SASL_AUTHENTICATION_ENABLED, true);
- attributes.put(HttpManagement.NAME, getTestName());
- attributes.put(HttpManagement.TIME_OUT, 10000l);
- attributes.put(ConfiguredObject.ID, _id);
- attributes.put(HttpManagement.DESIRED_STATE, State.QUIESCED);
- _management = new HttpManagement(attributes, _broker);
- _management.open();
- }
-
- public void testGetSessionTimeout()
- {
- assertEquals("Unexpected session timeout", 10000l, _management.getSessionTimeout());
- }
-
- public void testGetName()
- {
- assertEquals("Unexpected name", getTestName(), _management.getName());
- }
-
- public void testIsHttpsSaslAuthenticationEnabled()
- {
- assertEquals("Unexpected value for the https sasl enabled attribute", true,
- _management.isHttpsSaslAuthenticationEnabled());
- }
-
- public void testIsHttpSaslAuthenticationEnabled()
- {
- assertEquals("Unexpected value for the http sasl enabled attribute", false, _management.isHttpSaslAuthenticationEnabled());
- }
-
- public void testIsHttpsBasicAuthenticationEnabled()
- {
- assertEquals("Unexpected value for the https basic authentication enabled attribute", true,
- _management.isHttpsBasicAuthenticationEnabled());
- }
-
- public void testIsHttpBasicAuthenticationEnabled()
- {
- assertEquals("Unexpected value for the http basic authentication enabled attribute", false,
- _management.isHttpBasicAuthenticationEnabled());
- }
-
-
-}
diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/log/LogFileHelperTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/log/LogFileHelperTest.java
deleted file mode 100644
index 26e6cddc82..0000000000
--- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/log/LogFileHelperTest.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- *
- * 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.server.management.plugin.log;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.apache.log4j.Appender;
-import org.apache.log4j.DailyRollingFileAppender;
-import org.apache.log4j.FileAppender;
-import org.apache.log4j.QpidCompositeRollingAppender;
-import org.apache.log4j.RollingFileAppender;
-import org.apache.log4j.varia.ExternallyRolledFileAppender;
-import org.apache.qpid.test.utils.QpidTestCase;
-import org.apache.qpid.test.utils.TestFileUtils;
-import org.apache.qpid.util.FileUtils;
-
-public class LogFileHelperTest extends QpidTestCase
-{
- private Map<String, List<File>> _appendersFiles;
- private File _compositeRollingAppenderBackupFolder;
- private List<Appender> _appenders;
- private LogFileHelper _helper;
-
- public void setUp() throws Exception
- {
- super.setUp();
- _appendersFiles = new HashMap<String, List<File>>();
- _compositeRollingAppenderBackupFolder = new File(TMP_FOLDER, "_compositeRollingAppenderBackupFolder");
- _compositeRollingAppenderBackupFolder.mkdirs();
-
- _appendersFiles.put(FileAppender.class.getSimpleName(),
- Collections.singletonList(TestFileUtils.createTempFile(this, ".log", "FileAppender")));
- _appendersFiles.put(DailyRollingFileAppender.class.getSimpleName(),
- Collections.singletonList(TestFileUtils.createTempFile(this, ".log", "DailyRollingFileAppender")));
- _appendersFiles.put(RollingFileAppender.class.getSimpleName(),
- Collections.singletonList(TestFileUtils.createTempFile(this, ".log", "RollingFileAppender")));
- _appendersFiles.put(ExternallyRolledFileAppender.class.getSimpleName(),
- Collections.singletonList(TestFileUtils.createTempFile(this, ".log", "ExternallyRolledFileAppender")));
-
- File file = TestFileUtils.createTempFile(this, ".log", "QpidCompositeRollingAppender");
- File backUpFile = File.createTempFile(file.getName() + ".", ".1." + LogFileHelper.GZIP_EXTENSION);
- _appendersFiles.put(QpidCompositeRollingAppender.class.getSimpleName(), Arrays.asList(file, backUpFile));
-
- FileAppender fileAppender = new FileAppender();
- DailyRollingFileAppender dailyRollingFileAppender = new DailyRollingFileAppender();
- RollingFileAppender rollingFileAppender = new RollingFileAppender();
- ExternallyRolledFileAppender externallyRolledFileAppender = new ExternallyRolledFileAppender();
- QpidCompositeRollingAppender qpidCompositeRollingAppender = new QpidCompositeRollingAppender();
- qpidCompositeRollingAppender.setbackupFilesToPath(_compositeRollingAppenderBackupFolder.getPath());
-
- _appenders = new ArrayList<Appender>();
- _appenders.add(fileAppender);
- _appenders.add(dailyRollingFileAppender);
- _appenders.add(rollingFileAppender);
- _appenders.add(externallyRolledFileAppender);
- _appenders.add(qpidCompositeRollingAppender);
-
- for (Appender appender : _appenders)
- {
- FileAppender fa = (FileAppender) appender;
- fa.setName(fa.getClass().getSimpleName());
- fa.setFile(_appendersFiles.get(fa.getClass().getSimpleName()).get(0).getPath());
- }
-
- _helper = new LogFileHelper(_appenders);
- }
-
- public void tearDown() throws Exception
- {
- try
- {
- for (List<File> files : _appendersFiles.values())
- {
- for (File file : files)
- {
- try
- {
- FileUtils.delete(file, false);
- }
- catch (Exception e)
- {
- // ignore
- }
- }
- }
- FileUtils.delete(_compositeRollingAppenderBackupFolder, true);
- }
- finally
- {
- super.tearDown();
- }
- }
-
- public void testGetLogFileDetailsWithLocations() throws Exception
- {
- List<LogFileDetails> details = _helper.getLogFileDetails(true);
-
- assertLogFiles(details, true);
- }
-
- public void testGetLogFileDetailsWithoutLocations() throws Exception
- {
- List<LogFileDetails> details = _helper.getLogFileDetails(false);
-
- assertLogFiles(details, false);
- }
-
- public void testWriteLogFilesForAllLogs() throws Exception
- {
- List<LogFileDetails> details = _helper.getLogFileDetails(true);
- File f = TestFileUtils.createTempFile(this, ".zip");
-
- FileOutputStream os = new FileOutputStream(f);
- try
- {
- _helper.writeLogFiles(details, os);
- }
- finally
- {
- if (os != null)
- {
- os.close();
- }
- }
-
- assertWrittenFile(f, details);
- }
-
- public void testWriteLogFile() throws Exception
- {
- File file = _appendersFiles.get(FileAppender.class.getSimpleName()).get(0);
-
- File f = TestFileUtils.createTempFile(this, ".log");
- FileOutputStream os = new FileOutputStream(f);
- try
- {
- _helper.writeLogFile(file, os);
- }
- finally
- {
- if (os != null)
- {
- os.close();
- }
- }
-
- assertEquals("Unexpected log content", FileAppender.class.getSimpleName(), FileUtils.readFileAsString(f));
- }
-
- public void testFindLogFileDetails()
- {
- String[] logFileDisplayedPaths = new String[6];
- File[] files = new File[logFileDisplayedPaths.length];
- int i = 0;
- for (Map.Entry<String, List<File>> entry : _appendersFiles.entrySet())
- {
- String appenderName = entry.getKey();
- List<File> appenderFiles = entry.getValue();
- for (File logFile : appenderFiles)
- {
- logFileDisplayedPaths[i] = appenderName + "/" + logFile.getName();
- files[i++] = logFile;
- }
- }
-
- List<LogFileDetails> logFileDetails = _helper.findLogFileDetails(logFileDisplayedPaths);
- assertEquals("Unexpected details size", logFileDisplayedPaths.length, logFileDetails.size());
-
- boolean gzipFileFound = false;
- for (int j = 0; j < logFileDisplayedPaths.length; j++)
- {
- String displayedPath = logFileDisplayedPaths[j];
- String[] parts = displayedPath.split("/");
- LogFileDetails d = logFileDetails.get(j);
- assertEquals("Unexpected name", parts[1], d.getName());
- assertEquals("Unexpected appender", parts[0], d.getAppenderName());
- if (files[j].getName().endsWith(LogFileHelper.GZIP_EXTENSION))
- {
- assertEquals("Unexpected mime type for gz file", LogFileHelper.GZIP_MIME_TYPE, d.getMimeType());
- gzipFileFound = true;
- }
- else
- {
- assertEquals("Unexpected mime type", LogFileHelper.TEXT_MIME_TYPE, d.getMimeType());
- }
- assertEquals("Unexpected file location", files[j], d.getLocation());
- assertEquals("Unexpected file size", files[j].length(), d.getSize());
- assertEquals("Unexpected file last modified date", files[j].lastModified(), d.getLastModified());
- }
- assertTrue("Gzip log file is not found", gzipFileFound);
- }
-
- public void testFindLogFileDetailsForNotExistingAppender()
- {
- String[] logFileDisplayedPaths = { "NotExistingAppender/qpid.log" };
- List<LogFileDetails> details = _helper.findLogFileDetails(logFileDisplayedPaths);
- assertTrue("No details should be created for non-existing appender", details.isEmpty());
- }
-
- public void testFindLogFileDetailsForNotExistingFile()
- {
- String[] logFileDisplayedPaths = { "FileAppender/qpid-non-existing.log" };
- List<LogFileDetails> details = _helper.findLogFileDetails(logFileDisplayedPaths);
- assertTrue("No details should be created for non-existing file", details.isEmpty());
- }
-
- public void testFindLogFileDetailsForIncorrectlySpecifiedLogFilePath()
- {
- String[] logFileDisplayedPaths = { "FileAppender\\" + _appendersFiles.get("FileAppender").get(0).getName() };
- try
- {
- _helper.findLogFileDetails(logFileDisplayedPaths);
- fail("Exception is expected for incorrectly set path to log file");
- }
- catch (IllegalArgumentException e)
- {
- // pass
- }
- }
-
- private void assertLogFiles(List<LogFileDetails> details, boolean includeLocation)
- {
- for (Map.Entry<String, List<File>> appenderData : _appendersFiles.entrySet())
- {
- String appenderName = (String) appenderData.getKey();
- List<File> files = appenderData.getValue();
-
- for (File logFile : files)
- {
- String logFileName = logFile.getName();
- LogFileDetails d = findLogFileDetails(logFileName, appenderName, details);
- assertNotNull("Log file " + logFileName + " is not found for appender " + appenderName, d);
- if (includeLocation)
- {
- assertEquals("Log file " + logFileName + " is different in appender " + appenderName, d.getLocation(),
- logFile);
- }
- }
- }
- }
-
- private LogFileDetails findLogFileDetails(String logFileName, String appenderName, List<LogFileDetails> logFileDetails)
- {
- LogFileDetails d = null;
- for (LogFileDetails lfd : logFileDetails)
- {
- if (lfd.getName().equals(logFileName) && lfd.getAppenderName().equals(appenderName))
- {
- d = lfd;
- break;
- }
- }
- return d;
- }
-
- private void assertWrittenFile(File f, List<LogFileDetails> details) throws FileNotFoundException, IOException
- {
- FileInputStream fis = new FileInputStream(f);
- try
- {
- ZipInputStream zis = new ZipInputStream(fis);
- ZipEntry ze = zis.getNextEntry();
-
- while (ze != null)
- {
- String entryName = ze.getName();
- String[] parts = entryName.split("/");
-
- String appenderName = parts[0];
- String logFileName = parts[1];
-
- LogFileDetails d = findLogFileDetails(logFileName, appenderName, details);
-
- assertNotNull("Unexpected entry " + entryName, d);
- details.remove(d);
-
- File logFile = d.getLocation();
- String logContent = FileUtils.readFileAsString(logFile);
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- byte[] buffer = new byte[1024];
- int len;
- while ((len = zis.read(buffer)) > 0)
- {
- baos.write(buffer, 0, len);
- }
- baos.close();
-
- assertEquals("Unexpected log file content", logContent, baos.toString());
-
- ze = zis.getNextEntry();
- }
-
- zis.closeEntry();
- zis.close();
-
- }
- finally
- {
- if (fis != null)
- {
- fis.close();
- }
- }
- assertEquals("Not all log files have been output", 0, details.size());
- }
-
-}
diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/ReportRunnerTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/ReportRunnerTest.java
deleted file mode 100644
index 38432a26f4..0000000000
--- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/ReportRunnerTest.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- *
- * 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.server.management.plugin.report;
-
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.mockito.ArgumentCaptor;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-import org.apache.qpid.server.message.AMQMessageHeader;
-import org.apache.qpid.server.message.ServerMessage;
-import org.apache.qpid.server.model.Queue;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.QueueEntry;
-import org.apache.qpid.server.queue.QueueEntryVisitor;
-import org.apache.qpid.test.utils.QpidTestCase;
-
-public class ReportRunnerTest extends QpidTestCase
-{
- public void testTextReportCountsMessages()
- {
- ReportRunner<String> runner = (ReportRunner<String>) ReportRunner.createRunner(TestTextReport.NAME,
- Collections.<String, String[]>emptyMap());
- Queue queue = createMockQueue();
- assertEquals("There are 0 messages on the queue.", runner.runReport(queue));
-
- runner = (ReportRunner<String>) ReportRunner.createRunner(TestTextReport.NAME,
- Collections.<String, String[]>emptyMap());
- Queue queue1 = createMockQueue(mock(ServerMessage.class));
- assertEquals("There are 1 messages on the queue.", runner.runReport(queue1));
-
- runner = (ReportRunner<String>) ReportRunner.createRunner(TestTextReport.NAME,
- Collections.<String, String[]>emptyMap());
- Queue queue2 = createMockQueue(mock(ServerMessage.class), mock(ServerMessage.class));
- assertEquals("There are 2 messages on the queue.", runner.runReport(queue2));
- }
-
- public void testTextReportSingleStringParam()
- {
- Queue queue2 = createMockQueue(mock(ServerMessage.class), mock(ServerMessage.class));
-
- Map<String, String[]> parameterMap = new HashMap<>();
- parameterMap.put("stringParam", new String[]{"hello world"});
- ReportRunner<String> runner =
- (ReportRunner<String>) ReportRunner.createRunner(TestTextReport.NAME, parameterMap);
- assertEquals("There are 2 messages on the queue. stringParam = hello world.", runner.runReport(queue2));
- }
-
- public void testTextReportSingleStringArrayParam()
- {
- Queue queue = createMockQueue();
-
- Map<String, String[]> parameterMap = new HashMap<>();
- parameterMap.put("stringArrayParam", new String[] { "hello world", "goodbye"});
- ReportRunner<String> runner = (ReportRunner<String>) ReportRunner.createRunner(TestTextReport.NAME, parameterMap);
- assertEquals("There are 0 messages on the queue. stringArrayParam = [hello world, goodbye].", runner.runReport(queue));
-
- }
-
-
- public void testTextReportBothParams()
- {
- Queue queue = createMockQueue();
-
- Map<String, String[]> parameterMap = new HashMap<>();
- parameterMap.put("stringParam", new String[]{"hello world"});
- parameterMap.put("stringArrayParam", new String[] { "hello world", "goodbye"});
- ReportRunner<String> runner = (ReportRunner<String>) ReportRunner.createRunner(TestTextReport.NAME, parameterMap);
- assertEquals("There are 0 messages on the queue. stringParam = hello world. stringArrayParam = [hello world, goodbye].", runner.runReport(queue));
-
- }
-
- public void testInvalidReportName()
- {
- try
- {
- ReportRunner.createRunner("unknown", Collections.<String, String[]>emptyMap());
- fail("Unknown report name should throw exception");
- }
- catch(IllegalArgumentException e)
- {
- assertEquals("Unknown report: unknown", e.getMessage());
- }
- }
-
- public void testBinaryReportWithLimit() throws Exception
- {
- Queue queue = createMockQueue(createMessageWithAppProperties(Collections.<String,Object>singletonMap("key",1)),
- createMessageWithAppProperties(Collections.<String,Object>singletonMap("key",2)),
- createMessageWithAppProperties(Collections.<String, Object>singletonMap("key", 3)),
- createMessageWithAppProperties(Collections.<String, Object>singletonMap("key", 4)));
- Map<String, String[]> parameterMap = new HashMap<>();
- parameterMap.put("propertyName", new String[]{"key"});
- parameterMap.put("limit", new String[] { "3" });
-
- ReportRunner<byte[]> runner = (ReportRunner<byte[]>) ReportRunner.createRunner(TestBinaryReport.NAME, parameterMap);
-
- ByteArrayOutputStream bytes = new ByteArrayOutputStream();
- ObjectOutputStream objects = new ObjectOutputStream(bytes);
- objects.writeObject(Integer.valueOf(1));
- objects.writeObject(Integer.valueOf(2));
- objects.writeObject(Integer.valueOf(3));
- objects.flush();
- byte[] expected = bytes.toByteArray();
- byte[] actual = runner.runReport(queue);
- assertTrue("Output not as expected", Arrays.equals(expected, actual));
- }
-
- private ServerMessage<?> createMessageWithAppProperties(final Map<String,Object> props)
- {
- ServerMessage<?> message = mock(ServerMessage.class);
- final AMQMessageHeader header = mock(AMQMessageHeader.class);
- when(message.getMessageHeader()).thenReturn(header);
- final ArgumentCaptor<String> headerNameCaptor = ArgumentCaptor.forClass(String.class);
- when(header.getHeader(headerNameCaptor.capture())).thenAnswer(new Answer<Object>()
- {
- @Override
- public Object answer(final InvocationOnMock invocation) throws Throwable
- {
- String header = headerNameCaptor.getValue();
- return props.get(header);
- }
- });
- when(header.getHeaderNames()).thenReturn(props.keySet());
- return message;
- }
-
- private Queue createMockQueue(final ServerMessage<?>... messages)
- {
- final AMQQueue queue = mock(AMQQueue.class);
- final ArgumentCaptor<QueueEntryVisitor> captor = ArgumentCaptor.forClass(QueueEntryVisitor.class);
- doAnswer(new Answer()
- {
- @Override
- public Object answer(final InvocationOnMock invocation) throws Throwable
- {
- QueueEntryVisitor visitor = captor.getValue();
- for(ServerMessage<?> message : messages)
- {
- if(visitor.visit(makeEntry(queue, message)))
- {
- break;
- }
- }
- return null;
- }
- }).when(queue).visit(captor.capture());
- return queue;
- }
-
- private QueueEntry makeEntry(final AMQQueue queue, final ServerMessage<?> message)
- {
- QueueEntry entry = mock(QueueEntry.class);
- when(entry.getQueue()).thenReturn(queue);
- when(entry.getMessage()).thenReturn(message);
- return entry;
- }
-}
diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestBinaryReport.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestBinaryReport.java
deleted file mode 100644
index fc5e93631e..0000000000
--- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestBinaryReport.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- *
- * 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.server.management.plugin.report;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
-public class TestBinaryReport extends QueueBinaryReport
-{
-
-
- private int _limit;
- private String _propertyName;
- private int _count;
- private final ByteArrayOutputStream _bytesOutputStream = new ByteArrayOutputStream();
- private final ObjectOutputStream _objectOutputStream;
- public static final String NAME = "testBinary";
-
- public TestBinaryReport()
- {
- try
- {
- _objectOutputStream = new ObjectOutputStream(_bytesOutputStream);
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- ;
- }
-
- @Override
- public String getName()
- {
- return NAME;
- }
-
- @Override
- public String getContentType()
- {
- return "application/octet-stream";
- }
-
- @Override
- public void addMessage(final ReportableMessage reportableMessage)
- {
- if(_propertyName != null)
- {
- Object value = reportableMessage.getMessageHeader().getHeader(_propertyName);
- if(value != null)
- {
- try
- {
- _objectOutputStream.writeObject(value);
- }
- catch (IOException e)
- {
- // ignore
- }
- }
- }
- _count++;
- }
-
- @Override
- public boolean isComplete()
- {
- return _limit != 0 && _count >= _limit;
- }
-
- @Override
- public byte[] getReport()
- {
- try
- {
- _objectOutputStream.flush();
-
- return _bytesOutputStream.toByteArray();
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public void setLimit(final String limit)
- {
- _limit = Integer.parseInt(limit);
- }
-
- public void setPropertyName(final String propertyName)
- {
- this._propertyName = propertyName;
- }
-}
diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestTextReport.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestTextReport.java
deleted file mode 100644
index 7f9e1e2962..0000000000
--- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestTextReport.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * 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.server.management.plugin.report;
-
-import java.util.Arrays;
-
-public class TestTextReport extends QueueTextReport
-{
- public static final String NAME = "testText";
- private int _count;
- private String _stringParam;
- private String[] _stringArrayParam;
-
- @Override
- public String getName()
- {
- return NAME;
- }
-
- @Override
- public String getContentType()
- {
- return "text/plain";
- }
-
- @Override
- public void addMessage(final ReportableMessage reportableMessage)
- {
- _count++;
- }
-
- @Override
- public boolean isComplete()
- {
- return false;
- }
-
- @Override
- public String getReport()
- {
- StringBuilder result = new StringBuilder("There are " + _count + " messages on the queue.");
- if(_stringParam != null)
- {
- result.append(" stringParam = " + _stringParam + ".");
- }
- if(_stringArrayParam != null)
- {
- result.append(" stringArrayParam = " + Arrays.asList(_stringArrayParam) + ".");
- }
- return result.toString();
- }
-
- @SuppressWarnings("unused")
- public void setStringParam(final String value)
- {
- _stringParam = value;
- }
-
- @SuppressWarnings("unused")
- public void setStringArrayParam(final String[] value)
- {
- _stringArrayParam = value;
- }
-
-
-}
diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java
deleted file mode 100644
index 5fb73c8ee4..0000000000
--- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * 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.server.management.plugin.servlet.rest;
-
-import static org.apache.qpid.server.management.plugin.servlet.rest.ConfiguredObjectToMapConverter.STATISTICS_MAP_KEY;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyBoolean;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.apache.qpid.server.model.ConfiguredObject;
-import org.apache.qpid.server.model.ConfiguredObjectAttribute;
-import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry;
-import org.apache.qpid.server.model.Model;
-
-public class ConfiguredObjectToMapConverterTest extends TestCase
-{
- private ConfiguredObjectToMapConverter _converter = new ConfiguredObjectToMapConverter();
- private ConfiguredObject _configuredObject = mock(ConfiguredObject.class);
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- }
-
- public void testConfiguredObjectWithSingleStatistics() throws Exception
- {
- final String statisticName = "statisticName";
- final int statisticValue = 10;
-
- when(_configuredObject.getStatistics()).thenReturn(Collections.singletonMap(statisticName, (Number) statisticValue));
-
- Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject,
- ConfiguredObject.class,
- 0,
- false,
- false,
- false,
- false,
- 120,
- false);
- Map<String, Object> statsAsMap = (Map<String, Object>) resultMap.get(STATISTICS_MAP_KEY);
- assertNotNull("Statistics should be part of map", statsAsMap);
- assertEquals("Unexpected number of statistics", 1, statsAsMap.size());
- assertEquals("Unexpected statistic value", statisticValue, statsAsMap.get(statisticName));
- }
-
- public void testConfiguredObjectWithSingleNonConfiguredObjectAttribute() throws Exception
- {
- final String attributeName = "attribute";
- final String attributeValue = "value";
- Model model = createTestModel();
- when(_configuredObject.getModel()).thenReturn(model);
- configureMockToReturnOneAttribute(_configuredObject, attributeName, attributeValue);
-
- Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject,
- ConfiguredObject.class,
- 0,
- false,
- false,
- false,
- false,
- 120,
- false);
- assertEquals("Unexpected number of attributes", 1, resultMap.size());
- assertEquals("Unexpected attribute value", attributeValue, resultMap.get(attributeName));
- }
-
- /*
- * For now, it is the name of the configured object is returned as the attribute value, rather than the
- * configured object itself
- */
- public void testConfiguredObjectWithSingleConfiguredObjectAttribute() throws Exception
- {
- final String attributeName = "attribute";
- final ConfiguredObject attributeValue = mock(ConfiguredObject.class);
- when(attributeValue.getName()).thenReturn("attributeConfiguredObjectName");
-
- configureMockToReturnOneAttribute(_configuredObject, attributeName, attributeValue);
-
- Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject,
- ConfiguredObject.class,
- 0,
- false,
- false,
- false,
- false,
- 120,
- false);
- assertEquals("Unexpected number of attributes", 1, resultMap.size());
- assertEquals("Unexpected attribute value", "attributeConfiguredObjectName", resultMap.get(attributeName));
- }
-
- public void testConfiguredObjectWithChildAndDepth1()
- {
- final String childAttributeName = "childattribute";
- final String childAttributeValue = "childvalue";
-
- Model model = createTestModel();
-
- TestChild mockChild = mock(TestChild.class);
- when(mockChild.getModel()).thenReturn(model);
- when(_configuredObject.getModel()).thenReturn(model);
- configureMockToReturnOneAttribute(mockChild, childAttributeName, childAttributeValue);
- when(_configuredObject.getChildren(TestChild.class)).thenReturn(Arrays.asList(mockChild));
-
- Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject,
- ConfiguredObject.class,
- 1,
- false,
- false,
- false,
- false,
- 120,
- false);
- assertEquals("Unexpected parent map size", 1, resultMap.size());
-
- final List<Map<String, Object>> childList = (List<Map<String, Object>>) resultMap.get("testchilds");
- assertEquals("Unexpected number of children", 1, childList.size());
- final Map<String, Object> childMap = childList.get(0);
- assertEquals("Unexpected child map size", 1, childMap.size());
- assertNotNull(childMap);
-
- assertEquals("Unexpected child attribute value", childAttributeValue, childMap.get(childAttributeName));
- }
-
- public void testActuals()
- {
- final String childAttributeName = "childattribute";
- final String childAttributeValue = "childvalue";
- final String childActualAttributeValue = "${actualvalue}";
- final Map<String,Object> actualContext = Collections.<String,Object>singletonMap("key","value");
- final Set<String> inheritedKeys = new HashSet<>(Arrays.asList("key","inheritedkey"));
-
- Model model = createTestModel();
-
- TestChild mockChild = mock(TestChild.class);
- when(mockChild.getModel()).thenReturn(model);
- when(_configuredObject.getModel()).thenReturn(model);
- when(_configuredObject.getAttributeNames()).thenReturn(Collections.singletonList(ConfiguredObject.CONTEXT));
- when(_configuredObject.getContextValue(eq(String.class), eq("key"))).thenReturn("value");
- when(_configuredObject.getContextValue(eq(String.class),eq("inheritedkey"))).thenReturn("foo");
- when(_configuredObject.getContextKeys(anyBoolean())).thenReturn(inheritedKeys);
- when(_configuredObject.getContext()).thenReturn(actualContext);
- when(_configuredObject.getActualAttributes()).thenReturn(Collections.singletonMap(ConfiguredObject.CONTEXT, actualContext));
- when(mockChild.getAttributeNames()).thenReturn(Arrays.asList(childAttributeName, ConfiguredObject.CONTEXT));
- when(mockChild.getAttribute(childAttributeName)).thenReturn(childAttributeValue);
- when(mockChild.getActualAttributes()).thenReturn(Collections.singletonMap(childAttributeName, childActualAttributeValue));
- when(_configuredObject.getChildren(TestChild.class)).thenReturn(Arrays.asList(mockChild));
-
-
- Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject,
- ConfiguredObject.class,
- 1,
- true,
- false,
- false,
- false,
- 120,
- false);
- assertEquals("Unexpected parent map size", 2, resultMap.size());
- assertEquals("Incorrect context", resultMap.get(ConfiguredObject.CONTEXT), actualContext);
- List<Map<String, Object>> childList = (List<Map<String, Object>>) resultMap.get("testchilds");
- assertEquals("Unexpected number of children", 1, childList.size());
- Map<String, Object> childMap = childList.get(0);
- assertNotNull(childMap);
- assertEquals("Unexpected child map size", 1, childMap.size());
-
- assertEquals("Unexpected child attribute value", childActualAttributeValue, childMap.get(childAttributeName));
-
- resultMap = _converter.convertObjectToMap(_configuredObject,
- ConfiguredObject.class,
- 1,
- false,
- false,
- false,
- false,
- 120,
- false);
- assertEquals("Unexpected parent map size", 2, resultMap.size());
- Map<String, Object> inheritedContext = new HashMap<>();
- inheritedContext.put("key","value");
- inheritedContext.put("inheritedkey","foo");
- assertEquals("Incorrect context", inheritedContext, resultMap.get(ConfiguredObject.CONTEXT));
- childList = (List<Map<String, Object>>) resultMap.get("testchilds");
- assertEquals("Unexpected number of children", 1, childList.size());
- childMap = childList.get(0);
- assertEquals("Unexpected child map size", 1, childMap.size());
- assertNotNull(childMap);
-
- assertEquals("Unexpected child attribute value", childAttributeValue, childMap.get(childAttributeName));
-
- }
-
- public void testOversizedAttributes()
- {
-
- Model model = createTestModel();
- ConfiguredObjectTypeRegistry typeRegistry = model.getTypeRegistry();
- final Map<String, ConfiguredObjectAttribute<?, ?>> attributeTypes =
- typeRegistry.getAttributeTypes(TestChild.class);
- final ConfiguredObjectAttribute longAttr = mock(ConfiguredObjectAttribute.class);
- when(longAttr.isOversized()).thenReturn(true);
- when(longAttr.getOversizedAltText()).thenReturn("");
- when(attributeTypes.get(eq("longAttr"))).thenReturn(longAttr);
-
- TestChild mockChild = mock(TestChild.class);
- when(mockChild.getModel()).thenReturn(model);
- when(_configuredObject.getModel()).thenReturn(model);
- configureMockToReturnOneAttribute(mockChild, "longAttr", "this is not long");
- when(_configuredObject.getChildren(TestChild.class)).thenReturn(Arrays.asList(mockChild));
-
-
- Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject,
- ConfiguredObject.class,
- 1,
- false,
- false,
- false,
- false,
- 20,
- false);
- Object children = resultMap.get("testchilds");
- assertNotNull(children);
- assertTrue(children instanceof Collection);
- assertTrue(((Collection)children).size()==1);
- Object attrs = ((Collection)children).iterator().next();
- assertTrue(attrs instanceof Map);
- assertEquals("this is not long", ((Map) attrs).get("longAttr"));
-
-
-
- resultMap = _converter.convertObjectToMap(_configuredObject,
- ConfiguredObject.class,
- 1,
- false,
- false,
- false,
- false,
- 8,
- false);
-
- children = resultMap.get("testchilds");
- assertNotNull(children);
- assertTrue(children instanceof Collection);
- assertTrue(((Collection)children).size()==1);
- attrs = ((Collection)children).iterator().next();
- assertTrue(attrs instanceof Map);
- assertEquals("this...", ((Map) attrs).get("longAttr"));
-
-
-
-
- when(longAttr.getOversizedAltText()).thenReturn("test alt text");
-
- resultMap = _converter.convertObjectToMap(_configuredObject,
- ConfiguredObject.class,
- 1,
- false,
- false,
- false,
- false,
- 8,
- false);
-
- children = resultMap.get("testchilds");
- assertNotNull(children);
- assertTrue(children instanceof Collection);
- assertTrue(((Collection)children).size()==1);
- attrs = ((Collection)children).iterator().next();
- assertTrue(attrs instanceof Map);
- assertEquals("test alt text", ((Map) attrs).get("longAttr"));
-
-
- }
-
- public void testSecureAttributes()
- {
-
- Model model = createTestModel();
- ConfiguredObjectTypeRegistry typeRegistry = model.getTypeRegistry();
- Map<String, ConfiguredObjectAttribute<?, ?>> attributeTypes = typeRegistry.getAttributeTypes(TestChild.class);
- ConfiguredObjectAttribute secureAttribute = mock(ConfiguredObjectAttribute.class);
- when(secureAttribute.isSecure()).thenReturn(true);
- when(secureAttribute.isSecureValue(any())).thenReturn(true);
- when(attributeTypes.get(eq("secureAttribute"))).thenReturn(secureAttribute);
-
- TestChild mockChild = mock(TestChild.class);
- when(mockChild.getModel()).thenReturn(model);
- when(_configuredObject.getModel()).thenReturn(model);
-
- // set encoded value
- configureMockToReturnOneAttribute(mockChild, "secureAttribute", "*****");
-
- // set actual values
- when(mockChild.getActualAttributes()).thenReturn(Collections.singletonMap("secureAttribute", "secret"));
- when(_configuredObject.getChildren(TestChild.class)).thenReturn(Arrays.asList(mockChild));
- when(model.getParentTypes(TestChild.class)).thenReturn(Collections.<Class<? extends ConfiguredObject>>singleton(TestChild.class));
- when(_configuredObject.getCategoryClass()).thenReturn(TestChild.class);
- when(mockChild.isDurable()).thenReturn(true);
-
- Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject,
- ConfiguredObject.class,
- 1,
- false,
- false,
- false,
- false,
- 20,
- false);
- Object children = resultMap.get("testchilds");
- assertNotNull(children);
- assertTrue(children instanceof Collection);
- assertTrue(((Collection)children).size()==1);
- Object attrs = ((Collection)children).iterator().next();
- assertTrue(attrs instanceof Map);
- assertEquals("*****", ((Map) attrs).get("secureAttribute"));
-
- resultMap = _converter.convertObjectToMap(_configuredObject,
- ConfiguredObject.class,
- 1,
- true,
- true,
- false,
- true,
- 20,
- true);
-
- children = resultMap.get("testchilds");
- assertNotNull(children);
- assertTrue(children instanceof Collection);
- assertTrue(((Collection)children).size()==1);
- attrs = ((Collection)children).iterator().next();
- assertTrue(attrs instanceof Map);
- assertEquals("secret", ((Map) attrs).get("secureAttribute"));
-
- resultMap = _converter.convertObjectToMap(_configuredObject,
- ConfiguredObject.class,
- 1,
- true,
- true,
- false,
- false,
- 20,
- true);
-
- children = resultMap.get("testchilds");
- assertNotNull(children);
- assertTrue(children instanceof Collection);
- assertTrue(((Collection)children).size()==1);
- attrs = ((Collection)children).iterator().next();
- assertTrue(attrs instanceof Map);
- assertEquals("*****", ((Map) attrs).get("secureAttribute"));
- }
-
- private Model createTestModel()
- {
- Model model = mock(Model.class);
- final List<Class<? extends ConfiguredObject>> list = new ArrayList<Class<? extends ConfiguredObject>>();
- list.add(TestChild.class);
- when(model.getChildTypes(ConfiguredObject.class)).thenReturn(list);
- final ConfiguredObjectTypeRegistry typeRegistry = mock(ConfiguredObjectTypeRegistry.class);
- final Map<String, ConfiguredObjectAttribute<?, ?>> attrTypes = mock(Map.class);
- when(attrTypes.get(any(String.class))).thenReturn(mock(ConfiguredObjectAttribute.class));
- when(typeRegistry.getAttributeTypes(any(Class.class))).thenReturn(attrTypes);
- when(model.getTypeRegistry()).thenReturn(typeRegistry);
- return model;
- }
-
- private void configureMockToReturnOneAttribute(ConfiguredObject mockConfiguredObject, String attributeName, Object attributeValue)
- {
- when(mockConfiguredObject.getAttributeNames()).thenReturn(Arrays.asList(attributeName));
- when(mockConfiguredObject.getAttribute(attributeName)).thenReturn(attributeValue);
- }
-
- private static interface TestChild extends ConfiguredObject
- {
- }
-}
diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/session/LoginLogoutReporterTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/session/LoginLogoutReporterTest.java
deleted file mode 100644
index 45fa3fabd0..0000000000
--- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/session/LoginLogoutReporterTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.server.management.plugin.session;
-
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Mockito.when;
-
-import javax.security.auth.Subject;
-
-import org.apache.qpid.server.logging.EventLogger;
-import org.apache.qpid.server.logging.EventLoggerProvider;
-import org.apache.qpid.server.logging.LogMessage;
-import org.apache.qpid.server.logging.MessageLogger;
-import org.apache.qpid.server.security.auth.AuthenticatedPrincipal;
-import org.mockito.ArgumentMatcher;
-
-import junit.framework.TestCase;
-
-public class LoginLogoutReporterTest extends TestCase
-{
- private LoginLogoutReporter _loginLogoutReport;
- private Subject _subject = new Subject();
- private MessageLogger _logger = mock(MessageLogger.class);
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- _subject.getPrincipals().add(new AuthenticatedPrincipal("mockusername"));
- when(_logger.isEnabled()).thenReturn(true);
- when(_logger.isMessageEnabled(anyString())).thenReturn(true);
- EventLogger eventLogger = new EventLogger(_logger);
- EventLoggerProvider provider = mock(EventLoggerProvider.class);
- when(provider.getEventLogger()).thenReturn(eventLogger);
- _loginLogoutReport = new LoginLogoutReporter(_subject, provider);
- }
-
- public void testLoginLogged()
- {
- _loginLogoutReport.valueBound(null);
- verify(_logger).message(isLogMessageWithMessage("MNG-1007 : Open : User mockusername"));
- }
-
- public void testLogoutLogged()
- {
- _loginLogoutReport.valueUnbound(null);
- verify(_logger).message(isLogMessageWithMessage("MNG-1008 : Close : User mockusername"));
- }
-
- private LogMessage isLogMessageWithMessage(final String expectedMessage)
- {
- return argThat( new ArgumentMatcher<LogMessage>()
- {
- @Override
- public boolean matches(Object argument)
- {
- LogMessage actual = (LogMessage) argument;
- return actual.toString().equals(expectedMessage);
- }
- });
- }
-}
diff --git a/qpid/java/broker-plugins/management-http/src/test/resources/META-INF/services/org.apache.qpid.server.management.plugin.report.QueueReport b/qpid/java/broker-plugins/management-http/src/test/resources/META-INF/services/org.apache.qpid.server.management.plugin.report.QueueReport
deleted file mode 100644
index 7d25ec4378..0000000000
--- a/qpid/java/broker-plugins/management-http/src/test/resources/META-INF/services/org.apache.qpid.server.management.plugin.report.QueueReport
+++ /dev/null
@@ -1,2 +0,0 @@
-org.apache.qpid.server.management.plugin.report.TestTextReport
-org.apache.qpid.server.management.plugin.report.TestBinaryReport