use of org.apache.qpid.server.model.VirtualHost in project qpid-broker-j by apache.
the class TrustStoreMessageSourceTest method setUp.
@Before
public void setUp() throws Exception {
VirtualHost vhost = mock(VirtualHost.class);
MessageStore messageStore = new TestMemoryMessageStore();
TrustStore trustStore = mock(TrustStore.class);
Certificate certificate = mock(Certificate.class);
_certificates = new Certificate[] { certificate };
when(vhost.getMessageStore()).thenReturn(messageStore);
when(trustStore.getState()).thenReturn(State.ACTIVE);
when(trustStore.getCertificates()).thenReturn(_certificates);
when(certificate.getEncoded()).thenReturn("my certificate".getBytes());
_trustStoreMessageSource = new TrustStoreMessageSource(trustStore, vhost);
}
use of org.apache.qpid.server.model.VirtualHost in project qpid-broker-j by apache.
the class HouseKeepingTaskTest method runExecuteThrowsConnectionScopeRuntimeException.
@Test
public void runExecuteThrowsConnectionScopeRuntimeException() {
final VirtualHost virualHost = mock(VirtualHost.class);
final AccessControlContext context = AccessController.getContext();
final HouseKeepingTask task = new HouseKeepingTask(getTestName(), virualHost, context) {
@Override
public void execute() {
throw new ConnectionScopedRuntimeException("Test");
}
};
task.run();
}
use of org.apache.qpid.server.model.VirtualHost in project qpid-broker-j by apache.
the class VirtualHostPropertiesNodeTest method setUp.
@Before
public void setUp() throws Exception {
VirtualHost vhost = mock(VirtualHost.class);
MessageStore messageStore = new TestMemoryMessageStore();
when(vhost.getMessageStore()).thenReturn(messageStore);
_virtualHostPropertiesNode = new VirtualHostPropertiesNode(vhost);
}
use of org.apache.qpid.server.model.VirtualHost in project qpid-broker-j by apache.
the class JDBCVirtualHostTest method testDeleteAction.
@Test
public void testDeleteAction() {
_connectionURL = "jdbc:derby:memory:/" + getTestName();
Map<String, Object> attributes = new HashMap<>();
attributes.put(ConfiguredObject.NAME, getTestName());
attributes.put(ConfiguredObject.TYPE, JDBCVirtualHostImpl.VIRTUAL_HOST_TYPE);
attributes.put("connectionUrl", _connectionURL + ";create=true");
final VirtualHost vh = BrokerTestHelper.createVirtualHost(attributes, this);
AtomicBoolean deleted = new AtomicBoolean();
((JDBCContainer) vh).addDeleteAction(object -> deleted.set(true));
vh.delete();
assertEquals("Delete action was not invoked", true, deleted.get());
}
use of org.apache.qpid.server.model.VirtualHost in project qpid-broker-j by apache.
the class ContentServlet method doGet.
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response, final ConfiguredObject<?> managedObject) throws IOException {
ConfiguredObject root = managedObject;
String pathInfo = request.getPathInfo();
if (managedObject instanceof Broker && null != pathInfo && !pathInfo.isEmpty()) {
final ConfiguredObjectFinder finder = getConfiguredObjectFinder(managedObject);
final ConfiguredObject virtualHost = finder.findObjectFromPath(pathInfo.substring(1), VirtualHost.class);
if (null == virtualHost) {
sendError(response, HttpServletResponse.SC_NOT_FOUND);
return;
} else {
root = virtualHost;
}
} else if (managedObject instanceof VirtualHost && null != pathInfo && !pathInfo.isEmpty()) {
sendError(response, HttpServletResponse.SC_BAD_REQUEST);
return;
}
final Map<String, String[]> parameters = request.getParameterMap();
Content content = _contentFactory.createContent(root, parameters);
try {
writeContent(content, request, response);
} finally {
content.release();
}
}
Aggregations