src_fm_fc_ms_ff
stringlengths
43
86.8k
target
stringlengths
20
276k
ThriftMethodMetadata { public Method getMethod() { return method; } ThriftMethodMetadata(Method method, ThriftCatalog catalog); String getName(); ThriftType getReturnType(); List<ThriftFieldMetadata> getParameters(); Set<ThriftHeaderParameter> getHeaderParameters(); Map<Short, ExceptionInfo> getExceptions(); Method get...
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "ThriftMethod .* parameter 1 must not be annotated with both @ThriftField and @ThriftHeader") public void invalidHeaderAndFieldParameter() { Method validHeaderWithInferredFieldIds = getMethod("invalidHeaderAndFieldParameter", b...
DriftServer { public ServerTransport getServerTransport() { return serverTransport; } @Inject DriftServer( ServerTransportFactory serverTransportFactory, ThriftCodecManager codecManager, MethodInvocationStatsFactory methodInvocationStatsFactory, Set<DriftService> service...
@Test public void testGuiceServer() { ResultsSupplier resultsSupplier = new ResultsSupplier(); TestService testService = new TestService(resultsSupplier); TestingServerTransportFactory serverTransportFactory = new TestingServerTransportFactory(); TestingMethodInvocationStatsFactory statsFactory = new TestingMethodInvoc...
ThriftFramedDecoder extends ByteToMessageDecoder { @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } ThriftFramedDecoder(FrameInfoDecoder frameInfoDecoder, int maxFrameSizeInBytes); }
@Test public void testBelowLimit() { byte[] first = new byte[] {1, 2, 3, 4, 5}; byte[] second = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; byte[] third = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; try (TestingPooledByteBufAllocator allocator = new TestingPooledByteBufAllocator()) { Byte...
SimpleAddressSelectorBinder implements AddressSelectorBinder { public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } private SimpleAddressSelectorBinder(Optional<List<HostAndPort>> defaultAddresses); static AddressSelectorBinder simpleAddressSelector(...
@Test public void testNoDefaults() throws Exception { List<HostAndPort> addresses = ImmutableList.of(HostAndPort.fromParts("example.com", 1), HostAndPort.fromParts("example.com", 2)); Map<String, String> properties = ImmutableMap.of("testService" + ".thrift.client.addresses", "example.com:1,example.com:2"); testAddress...
ConnectionPool implements ConnectionManager { @Override public Future<Channel> getConnection(ConnectionParameters connectionParameters, HostAndPort address) { ConnectionKey key = new ConnectionKey(connectionParameters, address); while (true) { synchronized (this) { if (closed) { return group.next().newFailedFuture(new ...
@Test public void testPooling() { try (ConnectionPool pool = new ConnectionPool(new TestingConnectionManager(), new DefaultEventLoopGroup(), 10, new Duration(1, MINUTES))) { HostAndPort address1 = HostAndPort.fromParts("localhost", 1234); HostAndPort address2 = HostAndPort.fromParts("localhost", 4567); Channel channel1...
DriftNettyMethodInvoker implements MethodInvoker { @Override public ListenableFuture<Object> invoke(InvokeRequest request) { try { return MoreFutures.addTimeout( InvocationResponseFuture.createInvocationResponseFuture(request, connectionParameters, connectionManager), () -> { String message = "Invocation response futur...
@Test public void testTimeout() throws Exception { ScheduledExecutorService executor = newSingleThreadScheduledExecutor(daemonThreadsNamed("test-timeout")); DriftNettyMethodInvoker invoker = new DriftNettyMethodInvoker( new ConnectionParameters( FRAMED, BINARY, new DataSize(16, Unit.MEGABYTE), new Duration(11, MILLISEC...
DriftServerConfig { @Config("thrift.server.stats.enabled") public DriftServerConfig setStatsEnabled(boolean statsEnabled) { this.statsEnabled = statsEnabled; return this; } boolean isStatsEnabled(); @Config("thrift.server.stats.enabled") DriftServerConfig setStatsEnabled(boolean statsEnabled); }
@Test public void testDefaults() { assertRecordedDefaults(recordDefaults(DriftServerConfig.class) .setStatsEnabled(true)); } @Test public void testExplicitPropertyMappings() { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("thrift.server.stats.enabled", "false") .build(); DriftServerCo...
GenericJDBCConfigurationStore extends AbstractJDBCConfigurationStore implements MessageStoreProvider { @Override public void onDelete(final ConfiguredObject<?> parent) { assertState(CLOSED); ConnectionProvider connectionProvider = JdbcUtils.createConnectionProvider(parent, LOGGER); try { try (Connection conn = connecti...
@Test public void testOnDelete() throws Exception { try (Connection connection = openConnection()) { GenericJDBCConfigurationStore store = (GenericJDBCConfigurationStore) getConfigurationStore(); Collection<String> expectedTables = Arrays.asList(store.getConfiguredObjectHierarchyTableName(), store.getConfiguredObjectsT...
EnvHomeRegistry { public synchronized void registerHome(final File home) throws StoreException { if (home == null) { throw new IllegalArgumentException("home parameter cannot be null"); } String canonicalForm = getCanonicalForm(home); if (_canonicalNames.contains(canonicalForm)) { throw new IllegalArgumentException("JE...
@Test public void testDuplicateEnvHomeRejected() throws Exception { File home = new File(UnitTestBase.TMP_FOLDER, getTestName()); _ehr.registerHome(home); try { _ehr.registerHome(home); fail("Exception not thrown"); } catch (IllegalArgumentException iae) { } } @Test public void testUniqueEnvHomesAllowed() throws Except...
StandardEnvironmentFacade implements EnvironmentFacade { @Override public void close() { try { _committer.stop(); closeSequences(); closeDatabases(); } finally { try { closeEnvironment(); } finally { EnvHomeRegistry.getInstance().deregisterHome(_environmentPath); } } } StandardEnvironmentFacade(StandardEnvironmentConfi...
@Test public void testSecondEnvironmentFacadeUsingSamePathRejected() throws Exception { EnvironmentFacade ef = createEnvironmentFacade(); assertNotNull("Environment should not be null", ef); try { createEnvironmentFacade(); fail("Exception not thrown"); } catch (IllegalArgumentException iae) { } ef.close(); Environment...
ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { @Override public void close() { if (_state.compareAndSet(State.OPENING, State.CLOSING) || _state.compareAndSet(State.OPEN, State.CLOSING) || _state.compareAndSet(State.RESTARTING, State.CLOSING) ) { try { if (LOGGER.isDebugEnabled()) { LOGG...
@Test public void testClose() throws Exception { ReplicatedEnvironmentFacade ef = createMaster(); ef.close(); assertEquals("Unexpected state after close", ReplicatedEnvironmentFacade.State.CLOSED, ef.getFacadeState()); }
ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public String getGroupName() { return (String)_configuration.getGroupName(); } ReplicatedEnvironmentFacade(ReplicatedEnvironmentConfiguration configuration); @Override Transaction beginTransaction(TransactionConfig transactionConfig); @Over...
@Test public void testGetGroupName() throws Exception { assertEquals("Unexpected group name", TEST_GROUP_NAME, createMaster().getGroupName()); }
ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public String getNodeName() { return _configuration.getName(); } ReplicatedEnvironmentFacade(ReplicatedEnvironmentConfiguration configuration); @Override Transaction beginTransaction(TransactionConfig transactionConfig); @Override void comm...
@Test public void testGetNodeName() throws Exception { assertEquals("Unexpected group name", TEST_NODE_NAME, createMaster().getNodeName()); }
ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public long getLastKnownReplicationTransactionId() { if (_state.get() == State.OPEN) { try { VLSNRange range = RepInternal.getRepImpl(getEnvironment()).getVLSNIndex().getRange(); VLSN lastTxnEnd = range.getLastTxnEnd(); return lastTxnEnd.ge...
@Test public void testLastKnownReplicationTransactionId() throws Exception { ReplicatedEnvironmentFacade master = createMaster(); long lastKnownReplicationTransactionId = master.getLastKnownReplicationTransactionId(); assertTrue("Unexpected LastKnownReplicationTransactionId " + lastKnownReplicationTransactionId, lastKn...
ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public String getHostPort() { return (String)_configuration.getHostPort(); } ReplicatedEnvironmentFacade(ReplicatedEnvironmentConfiguration configuration); @Override Transaction beginTransaction(TransactionConfig transactionConfig); @Overri...
@Test public void testGetNodeHostPort() throws Exception { assertEquals("Unexpected node host port", TEST_NODE_HOST_PORT, createMaster().getHostPort()); }
ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public String getHelperHostPort() { return (String)_configuration.getHelperHostPort(); } ReplicatedEnvironmentFacade(ReplicatedEnvironmentConfiguration configuration); @Override Transaction beginTransaction(TransactionConfig transactionConf...
@Test public void testGetHelperHostPort() throws Exception { assertEquals("Unexpected node helper host port", TEST_NODE_HELPER_HOST_PORT, createMaster().getHelperHostPort()); }
CompositeFilter extends Filter<ILoggingEvent> { public void addLogInclusionRule(LogBackLogInclusionRule logInclusionRule) { Filter<ILoggingEvent> f = logInclusionRule.asFilter(); f.setName(logInclusionRule.getName()); _filterList.add(f); } void addLogInclusionRule(LogBackLogInclusionRule logInclusionRule); void remove...
@Test public void testAddLogInclusionRule() { CompositeFilter compositeFilter = new CompositeFilter(); LogBackLogInclusionRule rule = createRule(FilterReply.ACCEPT, "accept"); compositeFilter.addLogInclusionRule(rule); verify(rule.asFilter()).setName("accept"); }
ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public void setMessageStoreDurability(SyncPolicy localTransactionSynchronizationPolicy, SyncPolicy remoteTransactionSynchronizationPolicy, ReplicaAckPolicy replicaAcknowledgmentPolicy) { if (_messageStoreDurability == null || localTransacti...
@Test public void testSetMessageStoreDurability() throws Exception { ReplicatedEnvironmentFacade master = createMaster(); assertEquals("Unexpected message store durability", new Durability(Durability.SyncPolicy.NO_SYNC, Durability.SyncPolicy.NO_SYNC, Durability.ReplicaAckPolicy.SIMPLE_MAJORITY), master.getRealMessageSt...
ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public String getNodeState() { if (_state.get() != State.OPEN) { return ReplicatedEnvironment.State.UNKNOWN.name(); } try { ReplicatedEnvironment.State state = getEnvironment().getState(); return state.toString(); } catch (RuntimeException ...
@Test public void testGetNodeState() throws Exception { assertEquals("Unexpected state", State.MASTER.name(), createMaster().getNodeState()); }
ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public int getNumberOfElectableGroupMembers() { try { return getEnvironment().getGroup().getElectableNodes().size(); } catch(RuntimeException e) { throw handleDatabaseException("Exception on getting number of electable group members", e); }...
@Test public void testReplicationGroupListenerHearsAboutExistingRemoteReplicationNodes() throws Exception { ReplicatedEnvironmentFacade master = createMaster(); String nodeName2 = TEST_NODE_NAME + "_2"; String host = "localhost"; int port = _portHelper.getNextAvailable(); String node2NodeHostPort = host + ":" + port; f...
ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public void removeNodeFromGroup(final String nodeName) { try { createReplicationGroupAdmin().removeMember(nodeName); } catch (MasterStateException e) { throw new IllegalStateTransitionException(String.format("Node '%s' cannot be deleted whe...
@Test public void testRemoveNodeFromGroup() throws Exception { TestStateChangeListener stateChangeListener = new TestStateChangeListener(); ReplicatedEnvironmentFacade environmentFacade = addNode(TEST_NODE_NAME, TEST_NODE_HOST_PORT, true, stateChangeListener, new NoopReplicationGroupListener()); assertTrue("Environment...
ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { @Override public Transaction beginTransaction(TransactionConfig transactionConfig) { return getEnvironment().beginTransaction(null, transactionConfig); } ReplicatedEnvironmentFacade(ReplicatedEnvironmentConfiguration configuration); @Overri...
@Test public void testBeginTransaction() throws Exception { ReplicatedEnvironmentFacade facade = createMaster(); Transaction txn = null; try { TransactionConfig transactionConfig = new TransactionConfig(); transactionConfig.setDurability(facade.getRealMessageStoreDurability()); txn = facade.beginTransaction(transaction...
ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public void setPermittedNodes(Collection<String> permittedNodes) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(_prettyGroupNodeName + " permitted nodes set to " + permittedNodes); } _permittedNodes.clear(); if (permittedNodes != null) { _pe...
@Test public void testSetPermittedNodes() throws Exception { ReplicatedEnvironmentFacade firstNode = createMaster(); Set<String> permittedNodes = new HashSet<String>(); permittedNodes.add("localhost:" + TEST_NODE_PORT); permittedNodes.add("localhost:" + _portHelper.getNextAvailable()); firstNode.setPermittedNodes(permi...
BDBMessageStore extends AbstractBDBMessageStore { @Override public void onDelete(ConfiguredObject<?> parent) { if (isMessageStoreOpen()) { throw new IllegalStateException("Cannot delete the store as store is still open"); } FileBasedSettings fileBasedSettings = (FileBasedSettings)parent; String storePath = fileBasedSet...
@Test public void testOnDelete() throws Exception { String storeLocation = getStore().getStoreLocation(); File location = new File(storeLocation); assertTrue("Store does not exist at " + storeLocation, location.exists()); getStore().closeMessageStore(); assertTrue("Store does not exist at " + storeLocation, location.ex...
StandardEnvironmentFacadeFactory implements EnvironmentFacadeFactory { @SuppressWarnings("unchecked") @Override public EnvironmentFacade createEnvironmentFacade(final ConfiguredObject<?> parent) { final FileBasedSettings settings = (FileBasedSettings)parent; final String storeLocation = settings.getStorePath(); Standar...
@Test public void testCreateEnvironmentFacade() { when(_parent.getName()).thenReturn(getTestName()); when(_parent.getContextKeys(any(boolean.class))).thenReturn(Collections.singleton(EnvironmentConfig.ENV_IS_TRANSACTIONAL)); when(_parent.getContextValue(String.class, EnvironmentConfig.ENV_IS_TRANSACTIONAL)).thenReturn(...
MessageConverter_0_8_to_1_0 extends MessageConverter_to_1_0<AMQMessage> { @Override public String getType() { return "v0-8 to v1-0"; } @Override Class<AMQMessage> getInputClass(); @Override String getType(); }
@Test public void testConvertJmsStreamMessageBody() throws Exception { final List<Object> expected = Lists.newArrayList("apple", 43, 31.42D); final byte[] messageBytes = getJmsStreamMessageBytes(expected); final String mimeType = "jms/stream-message"; doTestStreamMessage(messageBytes, mimeType, expected, JmsMessageType...
MessageConverter_1_0_to_v0_8 implements MessageConverter<Message_1_0, AMQMessage> { @Override public AMQMessage convert(Message_1_0 serverMsg, NamedAddressSpace addressSpace) { return new AMQMessage(convertToStoredMessage(serverMsg, addressSpace), null); } @Override Class<Message_1_0> getInputClass(); @Override Class<...
@Test public void testAmqpValueWithNullWithTextMessageAnnotation() throws Exception { final Object expected = null; final AmqpValue amqpValue = new AmqpValue(expected); Message_1_0 sourceMessage = createTestMessage(TEXT_MESSAGE_MESSAGE_ANNOTATION, amqpValue.createEncodingRetainingSection()); final AMQMessage convertedM...
MessageConverter_v1_0_to_Internal implements MessageConverter<Message_1_0, InternalMessage> { @Override public InternalMessage convert(Message_1_0 serverMessage, NamedAddressSpace addressSpace) { Object bodyObject = MessageConverter_from_1_0.convertBodyToObject(serverMessage); final AMQMessageHeader convertHeader = con...
@Test public void testAmqpValueWithNullWithBytesMessageAnnotation() throws Exception { final Object expected = null; final AmqpValue amqpValue = new AmqpValue(expected); Message_1_0 sourceMessage = createTestMessage(BYTE_MESSAGE_MESSAGE_ANNOTATION, amqpValue.createEncodingRetainingSection()); final InternalMessage conv...
AMQShortString implements Comparable<AMQShortString> { @Override public boolean equals(Object o) { if (o == this) { return true; } if(o instanceof AMQShortString) { return equals((AMQShortString) o); } return false; } private AMQShortString(byte[] data); static String readAMQShortStringAsString(QpidByteBuffer buffer);...
@Test public void testEquals() { assertEquals(GOODBYE, AMQShortString.createAMQShortString("Goodbye")); assertEquals(AMQShortString.createAMQShortString("A"), AMQShortString.createAMQShortString("A")); assertFalse(AMQShortString.createAMQShortString("A").equals(AMQShortString.createAMQShortString("a"))); }
AMQShortString implements Comparable<AMQShortString> { public static AMQShortString createAMQShortString(byte[] data) { if (data == null) { throw new NullPointerException("Cannot create AMQShortString with null data[]"); } final AMQShortString cached = getShortStringCache().getIfPresent(ByteBuffer.wrap(data)); return c...
@Test public void testCreateAMQShortStringStringOver255() { String test = buildString('a', 256); try { AMQShortString.createAMQShortString(test); fail("It should not be possible to create AMQShortString with length over 255"); } catch (IllegalArgumentException e) { assertEquals("Exception message differs from expected"...
AMQShortString implements Comparable<AMQShortString> { static AMQShortString valueOf(Object obj, boolean truncate, boolean nullAsEmptyString) { if (obj == null) { if (nullAsEmptyString) { return EMPTY_STRING; } return null; } else { String value = String.valueOf(obj); int strLength = Math.min(value.length(), AMQShortSt...
@Test public void testValueOf() { String string = buildString('a', 255); AMQShortString shortString = AMQShortString.valueOf(string, true, true); assertEquals("Unexpected string from valueOf", string, shortString.toString()); } @Test public void testValueOfNulAsEmptyString() { AMQShortString shortString = AMQShortStrin...
BasicContentHeaderProperties { public synchronized int getPropertyListSize() { if(useEncodedForm()) { return _encodedForm.remaining(); } else { int size = 0; if ((_propertyFlags & (CONTENT_TYPE_MASK)) != 0) { size += EncodingUtils.encodedShortStringLength(_contentType); } if ((_propertyFlags & ENCODING_MASK) != 0) { si...
@Test public void testGetPropertyListSize() { int expectedSize = EncodingUtils.encodedIntegerLength(); expectedSize += EncodingUtils.encodedShortStringLength("TestInt"); expectedSize += 1 + EncodingUtils.encodedIntegerLength(); expectedSize += EncodingUtils.encodedShortStringLength("TestString"); expectedSize += 1 + En...
BasicContentHeaderProperties { public synchronized void dispose() { nullEncodedForm(); if (_headers != null) { _headers.dispose(); } } BasicContentHeaderProperties(BasicContentHeaderProperties other); BasicContentHeaderProperties(); BasicContentHeaderProperties(QpidByteBuffer buffer, int propertyFlags, int size); syn...
@Test public void testPopulatePropertiesFromBuffer() throws Exception { QpidByteBuffer buf = QpidByteBuffer.wrap(new byte[300]); _testProperties.dispose(); _testProperties = new BasicContentHeaderProperties(buf, 99, 99); }
BasicContentHeaderProperties { synchronized void reallocate() { if (_encodedForm != null) { _encodedForm = QpidByteBuffer.reallocateIfNecessary(_encodedForm); if (_headers != null) { _headers.dispose(); _headers = null; } rebuildHeadersIfHeadersMaskIsSet(); } } BasicContentHeaderProperties(BasicContentHeaderProperties ...
@Test public void testReallocate() throws Exception { try { QpidByteBuffer.deinitialisePool(); QpidByteBuffer.initialisePool(BUFFER_SIZE, POOL_SIZE, SPARSITY_FRACTION); try (QpidByteBuffer buffer = QpidByteBuffer.allocateDirect(BUFFER_SIZE)) { _testProperties.setContentType("text/plain"); _testProperties.setUserId("tes...
EncodingUtils { public static long readLongAsShortString(QpidByteBuffer buffer) throws AMQFrameDecodingException { short length = buffer.getUnsignedByte(); short pos = 0; if (length == 0) { return 0L; } byte digit = buffer.get(); boolean isNegative; long result = 0; if (digit == (byte) '-') { isNegative = true; pos++; ...
@Test public void testReadLongAsShortStringWhenDigitsAreSpecified() throws Exception { _buffer.putUnsignedByte((short)3); _buffer.put((byte)'9'); _buffer.put((byte)'2'); _buffer.put((byte)'0'); _buffer.flip(); assertEquals("Unexpected result", 920L, EncodingUtils.readLongAsShortString(_buffer)); } @Test public void tes...
AMQMessageMutator implements ServerMessageMutator<AMQMessage> { @Override public void setPriority(final byte priority) { _basicContentHeaderProperties.setPriority(priority); } AMQMessageMutator(final AMQMessage message, final MessageStore messageStore); @Override void setPriority(final byte priority); @Override byte ge...
@Test public void setPriority() { _messageMutator.setPriority((byte) (TEST_PRIORITY + 1)); assertThat(_messageMutator.getPriority(), is(equalTo((byte) (TEST_PRIORITY + 1)))); }
AMQMessageMutator implements ServerMessageMutator<AMQMessage> { @Override public byte getPriority() { return _basicContentHeaderProperties.getPriority(); } AMQMessageMutator(final AMQMessage message, final MessageStore messageStore); @Override void setPriority(final byte priority); @Override byte getPriority(); @Overri...
@Test public void getPriority() { assertThat((int) _messageMutator.getPriority(), is(equalTo((int) TEST_PRIORITY))); }
AMQMessageMutator implements ServerMessageMutator<AMQMessage> { @Override public AMQMessage create() { final long contentSize = _message.getSize(); final QpidByteBuffer content = _message.getContent(); final ContentHeaderBody contentHeader = new ContentHeaderBody(_basicContentHeaderProperties, contentSize); final Messa...
@Test public void create() { _messageMutator.setPriority((byte) (TEST_PRIORITY + 1)); AMQMessage newMessage = _messageMutator.create(); assertThat(newMessage.getMessageHeader().getPriority(), is(equalTo((byte) (TEST_PRIORITY + 1)))); assertThat(newMessage.getMessageHeader().getMimeType(), is(equalTo(TEST_CONTENT_TYPE))...
FieldTable { public long getEncodedSize() { return _fieldTableSupport.getEncodedSize(); } FieldTable(QpidByteBuffer input, int len); FieldTable(QpidByteBuffer buffer); FieldTable(Map<String, Object> properties); FieldTable(FieldTableSupport fieldTableSupport); @Override String toString(); void writeToBuffer(QpidB...
@Test public void testEncodingSize() { Map<String, Object> result = new LinkedHashMap<>(); int size = 0; result.put("boolean", true); size += 1 + EncodingUtils.encodedShortStringLength("boolean") + EncodingUtils.encodedBooleanLength(); result.put("byte", Byte.MAX_VALUE); size += 1 + EncodingUtils.encodedShortStringLeng...
FieldTable { @Override public String toString() { return _fieldTableSupport.toString(); } FieldTable(QpidByteBuffer input, int len); FieldTable(QpidByteBuffer buffer); FieldTable(Map<String, Object> properties); FieldTable(FieldTableSupport fieldTableSupport); @Override String toString(); void writeToBuffer(QpidB...
@Test public void testCheckPropertyNameHasMaxLength() { StringBuilder longPropertyName = new StringBuilder(129); for (int i = 0; i < 129; i++) { longPropertyName.append("x"); } boolean strictAMQP = FieldTable._strictAMQP; try { FieldTable._strictAMQP = true; new FieldTable(Collections.singletonMap(longPropertyName.toSt...
FieldTable { public void validate() { _fieldTableSupport.validate(); } FieldTable(QpidByteBuffer input, int len); FieldTable(QpidByteBuffer buffer); FieldTable(Map<String, Object> properties); FieldTable(FieldTableSupport fieldTableSupport); @Override String toString(); void writeToBuffer(QpidByteBuffer buffer); ...
@Test public void testValidateMalformedFieldTable() { final FieldTable fieldTable = buildMalformedFieldTable(); try { fieldTable.validate(); fail("Exception is expected"); } catch (RuntimeException e) { } }
AMQChannel extends AbstractAMQPSession<AMQChannel, ConsumerTarget_0_8> implements AsyncAutoCommitTransaction.FutureRecorder, ServerChannelMethodProcessor, EventLoggerProvider, CreditRestorer, org.apache.qpid.server.util.Deletable<AMQChannel> { @Override public void receiveExchangeD...
@Test public void testReceiveExchangeDeleteWhenIfUsedIsSetAndExchangeHasBindings() throws Exception { String testExchangeName = getTestName(); Exchange<?> exchange = mock(Exchange.class); when(exchange.hasBindings()).thenReturn(true); doReturn(exchange).when(_virtualHost).getAttainedMessageDestination(eq(testExchangeNa...
QpidException extends Exception { @Override public String toString() { return getClass().getName() + ": " + getMessage(); } QpidException(String msg); QpidException(String msg, Throwable cause); @Override String toString(); QpidException cloneForCurrentThread(); @Override QpidException clone(); }
@Test public void testGetMessageAsString() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < 25; i++) { sb.append("message [" + i + "]"); } AMQException e = new AMQException(ErrorCodes.INTERNAL_ERROR, sb.toString(), null); AMQShortString message = AMQShortString.validValueOf(e.getMessage()); assertEquals(sb...
HttpManagement extends AbstractPluginAdapter<HttpManagement> implements HttpManagementConfiguration<HttpManagement>, PortManager { @Override public int getSessionTimeout() { return _sessionTimeout; } @ManagedObjectFactoryConstructor HttpManagement(Map<String, Object> attributes, Broker broker); @Override int getSessio...
@Test public void testGetSessionTimeout() { assertEquals("Unexpected session timeout", 10000l, (long) _management.getSessionTimeout()); }
HttpManagement extends AbstractPluginAdapter<HttpManagement> implements HttpManagementConfiguration<HttpManagement>, PortManager { @Override public boolean isHttpsSaslAuthenticationEnabled() { return _httpsSaslAuthenticationEnabled; } @ManagedObjectFactoryConstructor HttpManagement(Map<String, Object> attributes, Brok...
@Test public void testIsHttpsSaslAuthenticationEnabled() { assertEquals("Unexpected value for the https sasl enabled attribute", true, _management.isHttpsSaslAuthenticationEnabled()); }
HttpManagement extends AbstractPluginAdapter<HttpManagement> implements HttpManagementConfiguration<HttpManagement>, PortManager { @Override public boolean isHttpSaslAuthenticationEnabled() { return _httpSaslAuthenticationEnabled; } @ManagedObjectFactoryConstructor HttpManagement(Map<String, Object> attributes, Broker...
@Test public void testIsHttpSaslAuthenticationEnabled() { assertEquals("Unexpected value for the http sasl enabled attribute", false, _management.isHttpSaslAuthenticationEnabled()); }
HttpManagement extends AbstractPluginAdapter<HttpManagement> implements HttpManagementConfiguration<HttpManagement>, PortManager { @Override public boolean isHttpsBasicAuthenticationEnabled() { return _httpsBasicAuthenticationEnabled; } @ManagedObjectFactoryConstructor HttpManagement(Map<String, Object> attributes, Br...
@Test public void testIsHttpsBasicAuthenticationEnabled() { assertEquals("Unexpected value for the https basic authentication enabled attribute", true, _management.isHttpsBasicAuthenticationEnabled()); }
HttpManagement extends AbstractPluginAdapter<HttpManagement> implements HttpManagementConfiguration<HttpManagement>, PortManager { @Override public boolean isHttpBasicAuthenticationEnabled() { return _httpBasicAuthenticationEnabled; } @ManagedObjectFactoryConstructor HttpManagement(Map<String, Object> attributes, Brok...
@Test public void testIsHttpBasicAuthenticationEnabled() { assertEquals("Unexpected value for the http basic authentication enabled attribute", false, _management.isHttpBasicAuthenticationEnabled()); }
LoginLogoutReporter implements HttpSessionBindingListener { @Override public void valueBound(HttpSessionBindingEvent arg0) { reportLogin(); } LoginLogoutReporter(Subject subject, EventLoggerProvider eventLoggerProvider); @Override void valueBound(HttpSessionBindingEvent arg0); @Override void valueUnbound(HttpSessionBin...
@Test public void testLoginLogged() { _loginLogoutReport.valueBound(null); verify(_logger).message(isLogMessageWithMessage("MNG-1007 : Open : User mockusername")); }
LoginLogoutReporter implements HttpSessionBindingListener { @Override public void valueUnbound(HttpSessionBindingEvent arg0) { reportLogout(); } LoginLogoutReporter(Subject subject, EventLoggerProvider eventLoggerProvider); @Override void valueBound(HttpSessionBindingEvent arg0); @Override void valueUnbound(HttpSession...
@Test public void testLogoutLogged() { _loginLogoutReport.valueUnbound(null); verify(_logger).message(isLogMessageWithMessage("MNG-1008 : Close : User mockusername")); }
HttpManagementUtil { public static String ensureFilenameIsRfc2183(final String requestedFilename) { return requestedFilename.replaceAll("[\\P{InBasic_Latin}\\\\:/\\p{Cntrl}]", ""); } static String getRequestSpecificAttributeName(String name, HttpServletRequest request); static HttpPort<?> getPort(final HttpServletRequ...
@Test public void testEnsureFilenameIsRfc2183() { assertEquals("Unexpected conversion", "aBC8-d.json", HttpManagementUtil.ensureFilenameIsRfc2183("aBC8-d.json\n\r\t:/\\")); }
CSVFormat { public <T extends Collection<?>> void printRecord(final Appendable out, final T record) throws IOException { boolean newRecord = true; for (Object item : record) { print(out, item, newRecord); newRecord = false; } println(out); } CSVFormat(); private CSVFormat(final char delimiter, final Char...
@Test public void testPrintRecord() throws Exception { CSVFormat csvFormat = new CSVFormat(); final StringWriter out = new StringWriter(); csvFormat.printRecord(out, Arrays.asList("test", 1, true, "\"quoted\" test")); assertEquals("Unexpected format", String.format("%s,%d,%b,%s%s", "test", 1, true, "\"\"\"quoted\"\" te...
CSVFormat { public <C extends Collection<? extends Collection<?>>> void printRecords(final Appendable out, final C records) throws IOException { for (Collection<?> record : records) { printRecord(out, record); } } CSVFormat(); private CSVFormat(final char delimiter, final Character quoteCharacter, ...
@Test public void testPrintRecords() throws Exception { CSVFormat csvFormat = new CSVFormat(); final StringWriter out = new StringWriter(); csvFormat.printRecords(out, Arrays.asList(Arrays.asList("test", 1, true, "\"quoted\" test"), Arrays.asList("delimeter,test", 1.0f, false, "quote\" in the middle"))); assertEquals("...
CSVFormat { public void println(final Appendable out) throws IOException { if (_recordSeparator != null) { out.append(_recordSeparator); } } CSVFormat(); private CSVFormat(final char delimiter, final Character quoteCharacter, final String recordSeparator); void printRecord(final Appendable ...
@Test public void testPrintln() throws Exception { CSVFormat csvFormat = new CSVFormat(); final StringWriter out = new StringWriter(); csvFormat.println(out); assertEquals("Unexpected new line", "\r\n", out.toString()); }
CSVFormat { public void print(final Appendable out, final Object value, final boolean newRecord) throws IOException { CharSequence charSequence; if (value == null) { charSequence = EMPTY; } else if (value instanceof CharSequence) { charSequence = (CharSequence) value; } else if (value instanceof Date || value instanceo...
@Test public void testPrint() throws Exception { CSVFormat csvFormat = new CSVFormat(); final StringWriter out = new StringWriter(); csvFormat.print(out, "test", true); csvFormat.print(out, 1, false); csvFormat.print(out, true, false); csvFormat.print(out, "\"quoted\" test", false); assertEquals("Unexpected format ", S...
CSVFormat { public void printComments(final Appendable out, final String... comments) throws IOException { for (String comment: comments) { out.append(COMMENT).append(SP).append(comment); println(out); } } CSVFormat(); private CSVFormat(final char delimiter, final Character quoteCharacter, ...
@Test public void testPrintComments() throws Exception { CSVFormat csvFormat = new CSVFormat(); final StringWriter out = new StringWriter(); csvFormat.printComments(out, "comment1", "comment2"); assertEquals("Unexpected format of comments", String.format("# %s%s# %s%s", "comment1", "\r\n", "comment2", "\r\n"), out.toSt...
TlsOrPlainConnectionFactory extends AbstractConnectionFactory { @Override public PlainOrTlsConnection newConnection(final Connector connector, final EndPoint realEndPoint) { final MarkableEndPoint endPoint = new MarkableEndPoint(realEndPoint); final PlainOrTlsConnection plainOrTlsConnection = new PlainOrTlsConnection(c...
@Test public void testOnFillableForTLS() throws Exception { AtomicBoolean firstPart = new AtomicBoolean(true); Answer<Object> answer = (InvocationOnMock invocation) -> { ByteBuffer dst = (ByteBuffer) invocation.getArguments()[0]; if (firstPart.get()) { firstPart.set(false); return writeBytes(dst, (byte) 22, (byte) 3, (...
GenericLegacyConfiguredObject implements LegacyConfiguredObject { @Override public Collection<String> getAttributeNames() { return _nextVersionLegacyConfiguredObject.getAttributeNames(); } GenericLegacyConfiguredObject(final LegacyManagementController managementController, final...
@Test public void getAttributeNames() { final Collection<String> attributeNames = Arrays.asList("foo", "bar", "test"); when(_nextVersionLegacyConfiguredObject.getAttributeNames()).thenReturn(attributeNames); Collection<String> names = _object.getAttributeNames(); assertThat(names, is(equalTo(attributeNames))); verify(_...
GenericLegacyConfiguredObject implements LegacyConfiguredObject { @Override public Object getAttribute(final String name) { return convertLegacyConfiguredObjectIfRequired(_nextVersionLegacyConfiguredObject.getAttribute(name)); } GenericLegacyConfiguredObject(final LegacyManagementController managementController, ...
@Test public void getAttribute() { final String attributeName = "name"; final String attributeValue = "test"; when(_nextVersionLegacyConfiguredObject.getAttribute(attributeName)).thenReturn(attributeValue); final Object value = _object.getAttribute(attributeName); assertThat(value, is(equalTo(attributeValue))); verify(...
GenericLegacyConfiguredObject implements LegacyConfiguredObject { @Override public Object getActualAttribute(final String name) { return _nextVersionLegacyConfiguredObject.getActualAttribute(name); } GenericLegacyConfiguredObject(final LegacyManagementController managementController, ...
@Test public void getActualAttribute() { final String attributeName = "name"; final String attributeValue = "test"; when(_nextVersionLegacyConfiguredObject.getActualAttribute(attributeName)).thenReturn(attributeValue); final Object value = _object.getActualAttribute(attributeName); assertThat(value, is(equalTo(attribut...
GenericLegacyConfiguredObject implements LegacyConfiguredObject { @Override public Collection<LegacyConfiguredObject> getChildren(final String category) { final Collection<LegacyConfiguredObject> children = _nextVersionLegacyConfiguredObject.getChildren(category); if (children != null) { return children.stream().map(_m...
@Test public void getChildren() { final String childrenCategory = "testChildrenCategory"; final LegacyConfiguredObject child = mock(LegacyConfiguredObject.class); final Collection<LegacyConfiguredObject> children = Collections.singleton(child); when(_nextVersionLegacyConfiguredObject.getChildren(childrenCategory)).then...
GenericLegacyConfiguredObject implements LegacyConfiguredObject { @Override public String getCategory() { return _category; } GenericLegacyConfiguredObject(final LegacyManagementController managementController, final LegacyConfiguredObject nextVersionLegacyConfiguredObject, ...
@Test public void getCategory() { assertThat(_object.getCategory(), is(equalTo(CATEGORY))); }
GenericLegacyConfiguredObject implements LegacyConfiguredObject { @Override public ManagementResponse invoke(final String operation, final Map<String, Object> parameters, final boolean isSecure) { ManagementResponse result = _nextVersionLegacyConfiguredObject.invoke(operation, parameters, isSecure); return convertLegac...
@Test public void invoke() { final String operationName = "testOperation"; final Map<String, Object> operationArguments = Collections.singletonMap("arg", "argValue"); final String operationResult = "testOperationResult"; final ControllerManagementResponse managementResponse = new ControllerManagementResponse( ResponseT...
GenericLegacyConfiguredObject implements LegacyConfiguredObject { @Override public LegacyConfiguredObject getNextVersionConfiguredObject() { return _nextVersionLegacyConfiguredObject; } GenericLegacyConfiguredObject(final LegacyManagementController managementController, final Le...
@Test public void getNextVersionConfiguredObject() { assertThat(_object.getNextVersionConfiguredObject(), is(equalTo(_nextVersionLegacyConfiguredObject))); }
GenericLegacyConfiguredObject implements LegacyConfiguredObject { @Override public LegacyConfiguredObject getParent(final String category) { LegacyConfiguredObject parent = _nextVersionLegacyConfiguredObject.getParent(category); return _managementController.convertFromNextVersion(parent); } GenericLegacyConfiguredObjec...
@Test public void getParent() { final String parentCategory = "testParentCategory"; final LegacyConfiguredObject nextVersionParent = mock(LegacyConfiguredObject.class); final LegacyConfiguredObject nextVersionParentConverted = mock(LegacyConfiguredObject.class); when(_nextVersionLegacyConfiguredObject.getParent(parentC...
GenericLegacyConfiguredObject implements LegacyConfiguredObject { @Override public boolean isSecureAttribute(final String name) { return _nextVersionLegacyConfiguredObject.isSecureAttribute(name); } GenericLegacyConfiguredObject(final LegacyManagementController managementController, ...
@Test public void isSecureAttribute() { final String attributeName = "testAttribute"; when(_nextVersionLegacyConfiguredObject.isSecureAttribute(attributeName)).thenReturn(true); assertThat(_object.isSecureAttribute(attributeName), is(equalTo(true))); verify(_nextVersionLegacyConfiguredObject).isSecureAttribute(attribut...
GenericLegacyConfiguredObject implements LegacyConfiguredObject { @Override public boolean isOversizedAttribute(final String name) { return _nextVersionLegacyConfiguredObject.isOversizedAttribute(name); } GenericLegacyConfiguredObject(final LegacyManagementController managementController, ...
@Test public void isOversizedAttribute() { final String attributeName = "testAttribute"; when(_nextVersionLegacyConfiguredObject.isOversizedAttribute(attributeName)).thenReturn(true); assertThat(_object.isOversizedAttribute(attributeName), is(equalTo(true))); verify(_nextVersionLegacyConfiguredObject).isOversizedAttrib...
GenericJDBCConfigurationStore extends AbstractJDBCConfigurationStore implements MessageStoreProvider { @Override public void upgradeStoreStructure() throws StoreException { upgradeIfNecessary(_parent); } GenericJDBCConfigurationStore(final Class<? extends ConfiguredObject> rootClass); @Override void init(ConfiguredObje...
@Test public void testUpgradeStoreStructure() throws Exception { GenericJDBCConfigurationStore store = (GenericJDBCConfigurationStore) getConfigurationStore(); store.closeConfigurationStore(); store.onDelete(getVirtualHostNode()); GenericJDBCConfigurationStore store2 = (GenericJDBCConfigurationStore) createConfigStore(...
GenericLegacyConfiguredObject implements LegacyConfiguredObject { @Override public String getContextValue(final String contextKey) { return _nextVersionLegacyConfiguredObject.getContextValue(contextKey); } GenericLegacyConfiguredObject(final LegacyManagementController managementController, ...
@Test public void getContextValue() { final String contextName = "testContext"; final String contextValue = "testValue"; when(_nextVersionLegacyConfiguredObject.getContextValue(contextName)).thenReturn(contextValue); assertThat(_object.getContextValue(contextName), is(equalTo(contextValue))); verify(_nextVersionLegacyC...
GenericLegacyConfiguredObject implements LegacyConfiguredObject { @Override public Map<String, Object> getStatistics() { return _nextVersionLegacyConfiguredObject.getStatistics(); } GenericLegacyConfiguredObject(final LegacyManagementController managementController, final Legacy...
@Test public void getStatistics() { Map<String, Object> stats = Collections.singletonMap("testStat", "statValue"); when(_nextVersionLegacyConfiguredObject.getStatistics()).thenReturn(stats); assertThat(_object.getStatistics(), is(equalTo(stats))); verify(_nextVersionLegacyConfiguredObject).getStatistics(); }
GenericLegacyConfiguredObject implements LegacyConfiguredObject { public LegacyManagementController getManagementController() { return _managementController; } GenericLegacyConfiguredObject(final LegacyManagementController managementController, final LegacyConfiguredObject nextV...
@Test public void getManagementController() { assertThat(_object.getManagementController(), is(equalTo(_managementController))); }
GenericLegacyConfiguredObject implements LegacyConfiguredObject { protected LegacyConfiguredObject getNextVersionLegacyConfiguredObject() { return _nextVersionLegacyConfiguredObject; } GenericLegacyConfiguredObject(final LegacyManagementController managementController, final Leg...
@Test public void getNextVersionLegacyConfiguredObject() { assertThat(_object.getNextVersionConfiguredObject(), is(equalTo(_nextVersionLegacyConfiguredObject))); }
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public String getVersion() { return _modelVersion; } AbstractLegacyConfiguredObjectController(final String modelVersion, final ManagementCon...
@Test public void getVersion() { assertThat(_controller.getVersion(), is(equalTo(TEST_VERSION))); }
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public Collection<String> getCategories() { return Collections.unmodifiableCollection(_categoryNames.values()); } AbstractLegacyConfiguredObjectController(final String modelVersion, ...
@Test public void getCategories() { Collection<String> categories = _controller.getCategories(); Set<String> expected = new HashSet<>(Arrays.asList(TEST_CATEGORY, TEST_CATEGORY_2)); assertThat(new HashSet<>(categories), is(equalTo(expected))); }
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public String getCategoryMapping(final String category) { return String.format("/api/v%s/%s/", getVersion(), category.toLowerCase()); } AbstractLegacyConfiguredObjectController(final String mo...
@Test public void getCategoryMapping() { assertThat(_controller.getCategoryMapping(TEST_CATEGORY), is(equalTo( String.format("/api/v%s/%s/", TEST_VERSION, TEST_CATEGORY.toLowerCase())))); }
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public String getCategory(final ConfiguredObject<?> managedObject) { return _nextVersionManagementController.getCategory(managedObject); } AbstractLegacyConfiguredObjectController(final String...
@Test public void getCategory() { final ConfiguredObject<?> managementObject = mock(ConfiguredObject.class); when(_nextVersionManagementController.getCategory(managementObject)).thenReturn(TEST_CATEGORY); String category = _controller.getCategory(managementObject); assertThat(category, is(equalTo(TEST_CATEGORY))); }
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public List<String> getCategoryHierarchy(final ConfiguredObject<?> root, final String categoryName) { return getCategoryHierarchy(getCategory(root), categoryName); } AbstractLegacyConfiguredOb...
@Test public void getCategoryHierarchy() { when(_nextVersionManagementController.getCategory(_root)).thenReturn(TEST_CATEGORY); final List<String> hierarchy = _controller.getCategoryHierarchy(_root, TEST_CATEGORY_2); final Set<String> expected = Collections.singleton(TEST_CATEGORY_2); assertThat(new HashSet<>(hierarchy...
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public ManagementController getNextVersionManagementController() { return _nextVersionManagementController; } AbstractLegacyConfiguredObjectController(final String modelVersion, ...
@Test public void getNextVersionManagementController() { assertThat(_controller.getNextVersionManagementController(), is(equalTo(_nextVersionManagementController))); } @Test public void getNextVersionLegacyConfiguredObjectConverter() { assertThat(_controller.getNextVersionManagementController(), is(equalTo(_nextVersion...
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public LegacyConfiguredObject createOrUpdate(final ConfiguredObject<?> root, final String category, final List<String> path, final Map<String, Object> attributes, final boolean isPost) throws ...
@Test public void createOrUpdate() { final List<String> path = Collections.singletonList("test"); final Map<String, Object> attributes = Collections.singletonMap("name", "test"); final LegacyConfiguredObject object = mock(LegacyConfiguredObject.class); when(_categoryController2.createOrUpdate(_root, path, attributes, f...
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public Object get(final ConfiguredObject<?> root, final String category, final List<String> path, final Map<String, List<String>> parameters) throws ManagementException { return getCategoryCon...
@Test public void get() { final List<String> path = Collections.singletonList("test"); final LegacyConfiguredObject object = mock(LegacyConfiguredObject.class); final Map<String, List<String>> parameters = Collections.singletonMap("name", Collections.singletonList("test")); when(_categoryController2.get(_root, path, pa...
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public int delete(final ConfiguredObject<?> root, final String category, final List<String> path, final Map<String, List<String>> parameters) throws ManagementException { return getCategoryCon...
@Test public void delete() { final List<String> path = Collections.singletonList("test"); final Map<String, List<String>> parameters = Collections.singletonMap("name", Collections.singletonList("test")); _controller.delete(_root, TEST_CATEGORY_2, path, parameters); verify(_categoryController2).delete(_root, path, param...
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public ManagementResponse invoke(final ConfiguredObject<?> root, final String category, final List<String> path, final String operation, final Map<String, Object> parameters, final boolean isP...
@Test public void invoke() { final List<String> path = Collections.singletonList("test"); final Map<String, Object> parameters = Collections.singletonMap("name", "test"); final Object operationResult = mock(Object.class); final String operationName = "testOperation"; final ManagementResponse managementResponse = new Co...
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public Object getPreferences(final ConfiguredObject<?> root, final String category, final List<String> path, final Map<String, List<String>> parameters) throws ManagementException { return get...
@Test public void getPreferences() { final List<String> path = Arrays.asList("test", "preferences"); final Map<String, List<String>> parameters = Collections.singletonMap("name", Collections.singletonList("test")); final Object prefs = mock(Object.class); when(_categoryController2.getPreferences(_root, path, parameters...
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public void setPreferences(final ConfiguredObject<?> root, final String category, final List<String> path, final Object preferences, final Map<String, List<String>> parameters, final boolean i...
@Test public void setPreferences() { final List<String> path = Arrays.asList("test", "preferences"); final Map<String, List<String>> parameters = Collections.singletonMap("name", Collections.singletonList("test")); final Object prefs = mock(Object.class); _controller.setPreferences(_root, TEST_CATEGORY_2, path, prefs, ...
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public int deletePreferences(final ConfiguredObject<?> root, final String category, final List<String> path, final Map<String, List<String>> parameters) throws ManagementException { return get...
@Test public void deletePreferences() { final List<String> path = Arrays.asList("test", "preferences"); final Map<String, List<String>> parameters = Collections.singletonMap("name", Collections.singletonList("test")); _controller.deletePreferences(_root, TEST_CATEGORY_2, path, parameters); verify(_categoryController2)....
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public CategoryController getCategoryController(final String category) { CategoryController converter = _categoryConverters.get(category.toLowerCase()); if (converter == null) { throw createIn...
@Test public void getCategoryController() { assertThat(_controller.getCategoryController(TEST_CATEGORY_2), is(equalTo(_categoryController2))); }
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public Set<TypeController> getTypeControllersByCategory(final String name) { Set<TypeController> typeControllers = _typeControllers.get(name.toLowerCase()); if (typeControllers == null) { retu...
@Test public void getTypeControllersByCategory() { final Set<TypeController> typeControllers = _controller.getTypeControllersByCategory(TEST_CATEGORY); assertThat(typeControllers, is(equalTo(Collections.singleton(_typeController)))); }
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public Collection<String> getChildrenCategories(String category) { List<String> children = _children.get(_categoryNames.get(category.toLowerCase())); if (children == null) { return Collections...
@Test public void getChildrenCategories() { final Collection<String> childrenCategories = _controller.getChildrenCategories(TEST_CATEGORY); assertThat(new HashSet<>(childrenCategories), is(equalTo(Collections.singleton(TEST_CATEGORY_2)))); }
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override public Collection<String> getParentTypes(final String category) { return _parents.get(category); } AbstractLegacyConfiguredObjectController(final String modelVersion, ...
@Test public void getParentTypes() { final Collection<String> childrenCategories = _controller.getParentTypes(TEST_CATEGORY_2); assertThat(new HashSet<>(childrenCategories), is(equalTo(Collections.singleton(TEST_CATEGORY)))); }
AbstractLegacyConfiguredObjectController extends AbstractManagementController implements LegacyManagementController { @Override protected RequestType getRequestType(final ManagementRequest managementRequest) throws ManagementException { final List<String> path = managementRequest.getPath(); final String category = mana...
@Test public void getRequestType() { final Map<String, List<String>> parameters = Collections.singletonMap("name", Collections.singletonList("test")); final ManagementRequest managementRequest = mock(ManagementRequest.class); doReturn(_root).when(managementRequest).getRoot(); when(managementRequest.getMethod()).thenRet...
LegacyManagementController extends AbstractLegacyConfiguredObjectController { @Override public Map<String, List<String>> convertQueryParameters(final Map<String, List<String>> requestParameters) { Map<String, List<String>> params = requestParameters .entrySet() .stream() .filter(e -> !INCLUDE_SYS_CONTEXT_PARAM.equals(e...
@Test public void convertQueryParameters() { final Map<String, List<String>> parameters = Collections.singletonMap("actuals", Collections.singletonList("true")); final Map<String, List<String>> converted = _controller.convertQueryParameters(parameters); assertThat(converted, is(notNullValue())); assertThat(converted.ge...
LegacyManagementController extends AbstractLegacyConfiguredObjectController { @Override public Object formatConfiguredObject(final Object content, final Map<String, List<String>> parameters, final boolean isSecureOrAllowedOnInsecureChannel) { final int depth = getIntParameterFromRequest(parameters, DEPTH_PARAM, DEFAULT...
@Test public void formatConfiguredObject() { final String objectName = "test-object"; final String hostName = "test-vhn"; final Map<String, List<String>> parameters = Collections.emptyMap(); final LegacyConfiguredObject object = mock(LegacyConfiguredObject.class); final LegacyConfiguredObject vhn = mock(LegacyConfigure...
LegacyManagementController extends AbstractLegacyConfiguredObjectController { @Override public Object get(final ConfiguredObject<?> root, final String category, final List<String> path, final Map<String, List<String>> parameters) throws ManagementException { Object result = super.get(root, category, path, convertQueryP...
@Test public void get() { final List<String> path = Collections.emptyList(); final LegacyConfiguredObject object = mock(LegacyConfiguredObject.class); final Map<String, List<String>> parameters = Collections.emptyMap(); final ConfiguredObject<?> root = mock(ConfiguredObject.class); when(_nextVersionManagementController...
PortController extends LegacyCategoryController { @Override protected LegacyConfiguredObject convertNextVersionLegacyConfiguredObject(final LegacyConfiguredObject object) { return new LegacyPort(getManagementController(), object); } PortController(final LegacyManagementController legacyManagementController, ...
@Test public void convertNextVersionLegacyConfiguredObject() { final LegacyConfiguredObject nextVersionPort = mock(LegacyConfiguredObject.class); when(nextVersionPort.getAttribute(LegacyConfiguredObject.NAME)).thenReturn("test"); when(nextVersionPort.getAttribute(LegacyConfiguredObject.TYPE)).thenReturn("HTTP"); Map<St...
PortController extends LegacyCategoryController { @Override public Map<String, Object> convertAttributesToNextVersion(final ConfiguredObject<?> root, final List<String> path, final Map<String, Object> attributes) { Map<String, Object> portAttributes = attributes; if ("HTTP".equals(portAttributes.get("type")) && portAtt...
@Test public void convertAttributesToNextVersion() { Map<String, Object> attributes = new HashMap<>(); attributes.put(LegacyConfiguredObject.NAME, "test"); attributes.put(LegacyConfiguredObject.TYPE, "HTTP"); Map<String, String> context = new HashMap<>(); context.put("port.http.maximumQueuedRequests", "2000"); context....
SessionController extends LegacyCategoryController { @Override protected LegacyConfiguredObject convertNextVersionLegacyConfiguredObject(final LegacyConfiguredObject object) { return new LegacySession(getManagementController(), object); } SessionController(final LegacyManagementController legacyManagementController, ...
@Test public void convertNextVersionLegacyConfiguredObject() { final UUID sessionID = UUID.randomUUID(); final LegacyConfiguredObject nextVersionSession = mock(LegacyConfiguredObject.class); final LegacyConfiguredObject nextVersionConsumer = mock(LegacyConfiguredObject.class); when(nextVersionSession.getCategory()).the...
ExchangeController extends DestinationController { @Override protected LegacyConfiguredObject convertNextVersionLegacyConfiguredObject(final LegacyConfiguredObject object) { return new LegacyExchange(getManagementController(), object); } ExchangeController(final LegacyManagementController legacyManagementController, ...
@Test public void convertNextVersionLegacyConfiguredObject() { final ExchangeController exchangeController = new ExchangeController(_legacyManagementController, Collections.emptySet()); final String exchangeName = "testExchange"; final String alternateExchangeName = "altExchange"; final String queueName = "testQueue"; ...
DestinationController extends LegacyCategoryController { @Override @SuppressWarnings("unchecked") public Map<String, Object> convertAttributesToNextVersion(final ConfiguredObject<?> root, final List<String> path, final Map<String, Object> attributes) { if (attributes.containsKey(LegacyDestination.ALTERNATE_EXCHANGE)) {...
@Test public void convertAttributesToNextVersion() { final String alternateExchangeName = "alternate"; final String queueName = "test"; final Map<String, Object> attributes = new HashMap<>(); attributes.put("alternateExchange", alternateExchangeName); attributes.put(LegacyConfiguredObject.NAME, queueName); final Destin...
LegacyCategoryControllerFactory implements CategoryControllerFactory { @Override public CategoryController createController(final String type, final LegacyManagementController legacyManagementController) { switch (type) { case CATEGORY_ACCESS_CONTROL_PROVIDER: return new LegacyCategoryController(legacyManagementControl...
@Test public void createController() { LegacyCategoryControllerFactory.SUPPORTED_CATEGORIES.forEach(category -> { final CategoryController controller = _factory.createController(category, _nextVersionManagementController); assertThat(controller.getCategory(), is(equalTo(category))); }); }
LegacyCategoryControllerFactory implements CategoryControllerFactory { @Override public Set<String> getSupportedCategories() { return SUPPORTED_CATEGORIES; } @Override CategoryController createController(final String type, final LegacyManagementController legacyManagement...
@Test public void getSupportedCategories() { assertThat(_factory.getSupportedCategories(), is(equalTo(LegacyCategoryControllerFactory.SUPPORTED_CATEGORIES))); }