target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testDequeueFromManyNonDurableQueuesOfPersistentMessage() throws Exception { _queueEntries = createTestQueueEntries(new boolean[] {false, false, false}, new boolean[] {true, true, true}); _transaction.dequeue(_queueEntries, _action); assertEquals( "Dequeue of persistent message from non-durable queues ... | @Override public void dequeue(MessageEnqueueRecord record, Action postTransactionAction) { Transaction txn = null; try { if(record != null) { LOGGER.debug("Dequeue of message number {} from transaction log. Queue : {}", record.getMessageNumber(), record.getQueueId()); txn = _messageStore.newTransaction(); txn.dequeueMe... | AutoCommitTransaction implements ServerTransaction { @Override public void dequeue(MessageEnqueueRecord record, Action postTransactionAction) { Transaction txn = null; try { if(record != null) { LOGGER.debug("Dequeue of message number {} from transaction log. Queue : {}", record.getMessageNumber(), record.getQueueId())... | AutoCommitTransaction implements ServerTransaction { @Override public void dequeue(MessageEnqueueRecord record, Action postTransactionAction) { Transaction txn = null; try { if(record != null) { LOGGER.debug("Dequeue of message number {} from transaction log. Queue : {}", record.getMessageNumber(), record.getQueueId())... | AutoCommitTransaction implements ServerTransaction { @Override public void dequeue(MessageEnqueueRecord record, Action postTransactionAction) { Transaction txn = null; try { if(record != null) { LOGGER.debug("Dequeue of message number {} from transaction log. Queue : {}", record.getMessageNumber(), record.getQueueId())... | AutoCommitTransaction implements ServerTransaction { @Override public void dequeue(MessageEnqueueRecord record, Action postTransactionAction) { Transaction txn = null; try { if(record != null) { LOGGER.debug("Dequeue of message number {} from transaction log. Queue : {}", record.getMessageNumber(), record.getQueueId())... |
@Test public void testDequeueFromDurableAndNonDurableQueuesOfPersistentMessage() throws Exception { _queueEntries = createTestQueueEntries(new boolean[] {true, false, true, true}, new boolean[] {true, true, true, false}); _transaction.dequeue(_queueEntries, _action); assertEquals( "Dequeue of persistent messages from d... | @Override public void dequeue(MessageEnqueueRecord record, Action postTransactionAction) { Transaction txn = null; try { if(record != null) { LOGGER.debug("Dequeue of message number {} from transaction log. Queue : {}", record.getMessageNumber(), record.getQueueId()); txn = _messageStore.newTransaction(); txn.dequeueMe... | AutoCommitTransaction implements ServerTransaction { @Override public void dequeue(MessageEnqueueRecord record, Action postTransactionAction) { Transaction txn = null; try { if(record != null) { LOGGER.debug("Dequeue of message number {} from transaction log. Queue : {}", record.getMessageNumber(), record.getQueueId())... | AutoCommitTransaction implements ServerTransaction { @Override public void dequeue(MessageEnqueueRecord record, Action postTransactionAction) { Transaction txn = null; try { if(record != null) { LOGGER.debug("Dequeue of message number {} from transaction log. Queue : {}", record.getMessageNumber(), record.getQueueId())... | AutoCommitTransaction implements ServerTransaction { @Override public void dequeue(MessageEnqueueRecord record, Action postTransactionAction) { Transaction txn = null; try { if(record != null) { LOGGER.debug("Dequeue of message number {} from transaction log. Queue : {}", record.getMessageNumber(), record.getQueueId())... | AutoCommitTransaction implements ServerTransaction { @Override public void dequeue(MessageEnqueueRecord record, Action postTransactionAction) { Transaction txn = null; try { if(record != null) { LOGGER.debug("Dequeue of message number {} from transaction log. Queue : {}", record.getMessageNumber(), record.getQueueId())... |
@Test public void testStoreDequeuesCauseExceptions() throws Exception { _queueEntries = createTestQueueEntries(new boolean[] {true}, new boolean[] {true}); _storeTransaction = createTestStoreTransaction(true); _transactionLog = MockStoreTransaction.createTestTransactionLog(_storeTransaction); _transaction = new AutoCom... | @Override public void dequeue(MessageEnqueueRecord record, Action postTransactionAction) { Transaction txn = null; try { if(record != null) { LOGGER.debug("Dequeue of message number {} from transaction log. Queue : {}", record.getMessageNumber(), record.getQueueId()); txn = _messageStore.newTransaction(); txn.dequeueMe... | AutoCommitTransaction implements ServerTransaction { @Override public void dequeue(MessageEnqueueRecord record, Action postTransactionAction) { Transaction txn = null; try { if(record != null) { LOGGER.debug("Dequeue of message number {} from transaction log. Queue : {}", record.getMessageNumber(), record.getQueueId())... | AutoCommitTransaction implements ServerTransaction { @Override public void dequeue(MessageEnqueueRecord record, Action postTransactionAction) { Transaction txn = null; try { if(record != null) { LOGGER.debug("Dequeue of message number {} from transaction log. Queue : {}", record.getMessageNumber(), record.getQueueId())... | AutoCommitTransaction implements ServerTransaction { @Override public void dequeue(MessageEnqueueRecord record, Action postTransactionAction) { Transaction txn = null; try { if(record != null) { LOGGER.debug("Dequeue of message number {} from transaction log. Queue : {}", record.getMessageNumber(), record.getQueueId())... | AutoCommitTransaction implements ServerTransaction { @Override public void dequeue(MessageEnqueueRecord record, Action postTransactionAction) { Transaction txn = null; try { if(record != null) { LOGGER.debug("Dequeue of message number {} from transaction log. Queue : {}", record.getMessageNumber(), record.getQueueId())... |
@Test public void testPostCommitActionFiredImmediately() throws Exception { _transaction.addPostTransactionAction(_action); assertTrue("Post commit action must be fired", _action.isPostCommitActionFired()); assertFalse("Rollback action must be fired", _action.isRollbackActionFired()); } | @Override public void addPostTransactionAction(final Action immediateAction) { immediateAction.postCommit(); } | AutoCommitTransaction implements ServerTransaction { @Override public void addPostTransactionAction(final Action immediateAction) { immediateAction.postCommit(); } } | AutoCommitTransaction implements ServerTransaction { @Override public void addPostTransactionAction(final Action immediateAction) { immediateAction.postCommit(); } AutoCommitTransaction(MessageStore transactionLog); } | AutoCommitTransaction implements ServerTransaction { @Override public void addPostTransactionAction(final Action immediateAction) { immediateAction.postCommit(); } AutoCommitTransaction(MessageStore transactionLog); @Override long getTransactionStartTime(); @Override long getTransactionUpdateTime(); @Override void addP... | AutoCommitTransaction implements ServerTransaction { @Override public void addPostTransactionAction(final Action immediateAction) { immediateAction.postCommit(); } AutoCommitTransaction(MessageStore transactionLog); @Override long getTransactionStartTime(); @Override long getTransactionUpdateTime(); @Override void addP... |
@Test public void testEnqueuePersistentMessagePostCommitNotCalledWhenFutureAlreadyComplete() throws Exception { setTestSystemProperty(STRICT_ORDER_SYSTEM_PROPERTY, "false"); when(_message.isPersistent()).thenReturn(true); when(_future.isDone()).thenReturn(true); AsyncAutoCommitTransaction asyncAutoCommitTransaction = n... | @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().persist(message.isPersistent())) { LOGGER.debug("Enqueue o... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... |
@Test public void testEnqueuePersistentMessageOnMultipleQueuesPostCommitNotCalled() throws Exception { setTestSystemProperty(STRICT_ORDER_SYSTEM_PROPERTY, "false"); when(_message.isPersistent()).thenReturn(true); when(_future.isDone()).thenReturn(true); AsyncAutoCommitTransaction asyncAutoCommitTransaction = new AsyncA... | @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().persist(message.isPersistent())) { LOGGER.debug("Enqueue o... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... |
@Test public void testEnqueuePersistentMessagePostCommitNotCalledWhenFutureNotYetComplete() throws Exception { setTestSystemProperty(STRICT_ORDER_SYSTEM_PROPERTY, "false"); when(_message.isPersistent()).thenReturn(true); when(_future.isDone()).thenReturn(false); AsyncAutoCommitTransaction asyncAutoCommitTransaction = n... | @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().persist(message.isPersistent())) { LOGGER.debug("Enqueue o... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... |
@Test public void testEnqueueTransientMessagePostCommitIsCalledWhenNotBehavingStrictly() throws Exception { setTestSystemProperty(STRICT_ORDER_SYSTEM_PROPERTY, "false"); when(_message.isPersistent()).thenReturn(false); AsyncAutoCommitTransaction asyncAutoCommitTransaction = new AsyncAutoCommitTransaction(_messageStore,... | @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().persist(message.isPersistent())) { LOGGER.debug("Enqueue o... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... |
@Test public void testEnqueueTransientMessagePostCommitIsCalledWhenBehavingStrictly() throws Exception { setTestSystemProperty(STRICT_ORDER_SYSTEM_PROPERTY, "true"); when(_message.isPersistent()).thenReturn(false); AsyncAutoCommitTransaction asyncAutoCommitTransaction = new AsyncAutoCommitTransaction(_messageStore, _fu... | @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().persist(message.isPersistent())) { LOGGER.debug("Enqueue o... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... | AsyncAutoCommitTransaction implements ServerTransaction { @Override public void enqueue(TransactionLogResource queue, EnqueueableMessage message, EnqueueAction postTransactionAction) { Transaction txn = null; try { ListenableFuture<Void> future; final MessageEnqueueRecord enqueueRecord; if(queue.getMessageDurability().... |
@Test public void testOnMessageEnqueue() throws Exception { EnqueueableMessage<?> message1 = createMessage(MAX_UNCOMMITTED_IN_MEMORY_SIZE); EnqueueableMessage<?> message2 = createMessage(1); EnqueueableMessage<?> message3 = createMessage(1); _flowToDiskMessageObserver.onMessageEnqueue(_transaction, message1); StoredMes... | @Override public void onMessageEnqueue(final ServerTransaction transaction, final EnqueueableMessage<? extends StorableMessageMetaData> message) { StoredMessage<? extends StorableMessageMetaData> handle = message.getStoredMessage(); long messageSize = handle.getContentSize() + handle.getMetadataSize(); long newUncommit... | FlowToDiskTransactionObserver implements TransactionObserver { @Override public void onMessageEnqueue(final ServerTransaction transaction, final EnqueueableMessage<? extends StorableMessageMetaData> message) { StoredMessage<? extends StorableMessageMetaData> handle = message.getStoredMessage(); long messageSize = handl... | FlowToDiskTransactionObserver implements TransactionObserver { @Override public void onMessageEnqueue(final ServerTransaction transaction, final EnqueueableMessage<? extends StorableMessageMetaData> message) { StoredMessage<? extends StorableMessageMetaData> handle = message.getStoredMessage(); long messageSize = handl... | FlowToDiskTransactionObserver implements TransactionObserver { @Override public void onMessageEnqueue(final ServerTransaction transaction, final EnqueueableMessage<? extends StorableMessageMetaData> message) { StoredMessage<? extends StorableMessageMetaData> handle = message.getStoredMessage(); long messageSize = handl... | FlowToDiskTransactionObserver implements TransactionObserver { @Override public void onMessageEnqueue(final ServerTransaction transaction, final EnqueueableMessage<? extends StorableMessageMetaData> message) { StoredMessage<? extends StorableMessageMetaData> handle = message.getStoredMessage(); long messageSize = handl... |
@Test public void testReceiveAttachToNonExistingQueue() throws Exception { final String linkName = "testLink"; Attach attach = createQueueAttach(false, linkName, QUEUE_NAME); _session.receiveAttach(attach); assertAttachFailed(_connection, _session, attach); } | public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inputHandleToEndpoint.containsKey(inputHandle)) { String errorMessage = String.format("Input Handle '%d' already in use", inputHandle.intValue()); getCon... | Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget_1_0> implements LogSubject, org.apache.qpid.server.util.Deletable<Session_1_0> { public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inpu... | Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget_1_0> implements LogSubject, org.apache.qpid.server.util.Deletable<Session_1_0> { public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inpu... | Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget_1_0> implements LogSubject, org.apache.qpid.server.util.Deletable<Session_1_0> { public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inpu... | Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget_1_0> implements LogSubject, org.apache.qpid.server.util.Deletable<Session_1_0> { public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inpu... |
@Test public void testOnDischarge() throws Exception { EnqueueableMessage<?> message1 = createMessage(MAX_UNCOMMITTED_IN_MEMORY_SIZE - 1); EnqueueableMessage<?> message2 = createMessage(1); EnqueueableMessage<?> message3 = createMessage(1); _flowToDiskMessageObserver.onMessageEnqueue(_transaction, message1); final Serv... | @Override public void onDischarge(final ServerTransaction transaction) { TransactionDetails transactionDetails = _uncommittedMessages.remove(transaction); if (transactionDetails != null) { _uncommittedMessageSize.addAndGet(-transactionDetails.getUncommittedMessageSize()); } if (_maxUncommittedInMemorySize > _uncommitte... | FlowToDiskTransactionObserver implements TransactionObserver { @Override public void onDischarge(final ServerTransaction transaction) { TransactionDetails transactionDetails = _uncommittedMessages.remove(transaction); if (transactionDetails != null) { _uncommittedMessageSize.addAndGet(-transactionDetails.getUncommitted... | FlowToDiskTransactionObserver implements TransactionObserver { @Override public void onDischarge(final ServerTransaction transaction) { TransactionDetails transactionDetails = _uncommittedMessages.remove(transaction); if (transactionDetails != null) { _uncommittedMessageSize.addAndGet(-transactionDetails.getUncommitted... | FlowToDiskTransactionObserver implements TransactionObserver { @Override public void onDischarge(final ServerTransaction transaction) { TransactionDetails transactionDetails = _uncommittedMessages.remove(transaction); if (transactionDetails != null) { _uncommittedMessageSize.addAndGet(-transactionDetails.getUncommitted... | FlowToDiskTransactionObserver implements TransactionObserver { @Override public void onDischarge(final ServerTransaction transaction) { TransactionDetails transactionDetails = _uncommittedMessages.remove(transaction); if (transactionDetails != null) { _uncommittedMessageSize.addAndGet(-transactionDetails.getUncommitted... |
@Test public void testDefault_1() throws Exception { bindHeaders.put("A", "Value of A"); matchHeaders.setString("A", "Value of A"); AbstractExchange.BindingIdentifier b = new AbstractExchange.BindingIdentifier(getQueueName(), _queue); assertTrue(new HeadersBinding(b, bindHeaders).matches(matchHeaders)); } | public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... |
@Test public void testDefault_2() throws Exception { bindHeaders.put("A", "Value of A"); matchHeaders.setString("A", "Value of A"); matchHeaders.setString("B", "Value of B"); AbstractExchange.BindingIdentifier b = new AbstractExchange.BindingIdentifier(getQueueName(), _queue); assertTrue(new HeadersBinding(b, bindHeade... | public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... |
@Test public void testDefault_3() throws Exception { bindHeaders.put("A", "Value of A"); matchHeaders.setString("A", "Altered value of A"); AbstractExchange.BindingIdentifier b = new AbstractExchange.BindingIdentifier(getQueueName(), _queue); assertFalse(new HeadersBinding(b, bindHeaders).matches(matchHeaders)); } | public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... |
@Test public void testAll_1() throws Exception { bindHeaders.put("X-match", "all"); bindHeaders.put("A", "Value of A"); matchHeaders.setString("A", "Value of A"); AbstractExchange.BindingIdentifier b = new AbstractExchange.BindingIdentifier(getQueueName(), _queue); assertTrue(new HeadersBinding(b, bindHeaders).matches(... | public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... |
@Test public void testAll_2() throws Exception { bindHeaders.put("X-match", "all"); bindHeaders.put("A", "Value of A"); bindHeaders.put("B", "Value of B"); matchHeaders.setString("A", "Value of A"); AbstractExchange.BindingIdentifier b = new AbstractExchange.BindingIdentifier(getQueueName(), _queue); assertFalse(new He... | public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... |
@Test public void testAll_3() throws Exception { bindHeaders.put("X-match", "all"); bindHeaders.put("A", "Value of A"); bindHeaders.put("B", "Value of B"); matchHeaders.setString("A", "Value of A"); matchHeaders.setString("B", "Value of B"); AbstractExchange.BindingIdentifier b = new AbstractExchange.BindingIdentifier(... | public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... |
@Test public void testAll_4() throws Exception { bindHeaders.put("X-match", "all"); bindHeaders.put("A", "Value of A"); bindHeaders.put("B", "Value of B"); matchHeaders.setString("A", "Value of A"); matchHeaders.setString("B", "Value of B"); matchHeaders.setString("C", "Value of C"); AbstractExchange.BindingIdentifier ... | public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... |
@Test public void testAll_5() throws Exception { bindHeaders.put("X-match", "all"); bindHeaders.put("A", "Value of A"); bindHeaders.put("B", "Value of B"); matchHeaders.setString("A", "Value of A"); matchHeaders.setString("B", "Altered value of B"); matchHeaders.setString("C", "Value of C"); AbstractExchange.BindingIde... | public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... |
@Test public void testAny_1() throws Exception { bindHeaders.put("X-match", "any"); bindHeaders.put("A", "Value of A"); matchHeaders.setString("A", "Value of A"); AbstractExchange.BindingIdentifier b = new AbstractExchange.BindingIdentifier(getQueueName(), _queue); assertTrue(new HeadersBinding(b, bindHeaders).matches(... | public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... |
@Test public void testReceiveAttachTopicNonDurableNoContainerWithInvalidSelector() throws Exception { final String linkName = "testLink"; final String address = "amq.direct/" + TOPIC_NAME; Attach attach = createTopicAttach(false, linkName, address, true); setSelector(attach, "invalid selector"); _session.receiveAttach(... | public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inputHandleToEndpoint.containsKey(inputHandle)) { String errorMessage = String.format("Input Handle '%d' already in use", inputHandle.intValue()); getCon... | Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget_1_0> implements LogSubject, org.apache.qpid.server.util.Deletable<Session_1_0> { public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inpu... | Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget_1_0> implements LogSubject, org.apache.qpid.server.util.Deletable<Session_1_0> { public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inpu... | Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget_1_0> implements LogSubject, org.apache.qpid.server.util.Deletable<Session_1_0> { public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inpu... | Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget_1_0> implements LogSubject, org.apache.qpid.server.util.Deletable<Session_1_0> { public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inpu... |
@Test public void testAny_2() throws Exception { bindHeaders.put("X-match", "any"); bindHeaders.put("A", "Value of A"); bindHeaders.put("B", "Value of B"); matchHeaders.setString("A", "Value of A"); AbstractExchange.BindingIdentifier b = new AbstractExchange.BindingIdentifier(getQueueName(), _queue); assertTrue(new Hea... | public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... |
@Test public void testAny_3() throws Exception { bindHeaders.put("X-match", "any"); bindHeaders.put("A", "Value of A"); bindHeaders.put("B", "Value of B"); matchHeaders.setString("A", "Value of A"); matchHeaders.setString("B", "Value of B"); AbstractExchange.BindingIdentifier b = new AbstractExchange.BindingIdentifier(... | public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... |
@Test public void testAny_4() throws Exception { bindHeaders.put("X-match", "any"); bindHeaders.put("A", "Value of A"); bindHeaders.put("B", "Value of B"); matchHeaders.setString("A", "Value of A"); matchHeaders.setString("B", "Value of B"); matchHeaders.setString("C", "Value of C"); AbstractExchange.BindingIdentifier ... | public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... |
@Test public void testAny_5() throws Exception { bindHeaders.put("X-match", "any"); bindHeaders.put("A", "Value of A"); bindHeaders.put("B", "Value of B"); matchHeaders.setString("A", "Value of A"); matchHeaders.setString("B", "Altered value of B"); matchHeaders.setString("C", "Value of C"); AbstractExchange.BindingIde... | public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... |
@Test public void testAny_6() throws Exception { bindHeaders.put("X-match", "any"); bindHeaders.put("A", "Value of A"); bindHeaders.put("B", "Value of B"); matchHeaders.setString("A", "Altered value of A"); matchHeaders.setString("B", "Altered value of B"); matchHeaders.setString("C", "Value of C"); AbstractExchange.Bi... | public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); } | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... | HeadersBinding { public boolean matches(AMQMessageHeader headers) { if(headers == null) { return required.isEmpty() && matches.isEmpty(); } else { return matchAny ? or(headers) : and(headers); } } HeadersBinding(AbstractExchange.BindingIdentifier binding, Map<String,Object> arguments); AbstractExchange.BindingIdentifie... |
@Test public void testInvalidRegex() { Map<String, List<String>> contextValues = new HashMap<>(); contextValues.put(ConnectionVersionValidator.VIRTUALHOST_REJECTED_CONNECTION_VERSION, Arrays.asList("${}", "foo")); setContextValues(contextValues); when(_connectionMock.getClientVersion()).thenReturn("foo"); assertFalse(_... | @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolean valid = true; if (!connectionMatches(virtualHost, VIRTUALH... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... |
@Test public void testNullClientDefaultAllowed() { assertTrue(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); } | @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolean valid = true; if (!connectionMatches(virtualHost, VIRTUALH... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... |
@Test public void testClientDefaultAllowed() { when(_connectionMock.getClientVersion()).thenReturn("foo"); assertTrue(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); } | @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolean valid = true; if (!connectionMatches(virtualHost, VIRTUALH... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... |
@Test public void testEmptyList() { Map<String, List<String>> contextValues = new HashMap<>(); contextValues.put(ConnectionVersionValidator.VIRTUALHOST_REJECTED_CONNECTION_VERSION, Collections.<String>emptyList()); setContextValues(contextValues); when(_connectionMock.getClientVersion()).thenReturn("foo"); assertTrue(_... | @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolean valid = true; if (!connectionMatches(virtualHost, VIRTUALH... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... |
@Test public void testEmptyString() { Map<String, List<String>> contextValues = new HashMap<>(); contextValues.put(ConnectionVersionValidator.VIRTUALHOST_REJECTED_CONNECTION_VERSION, Arrays.asList("")); setContextValues(contextValues); when(_connectionMock.getClientVersion()).thenReturn(""); assertFalse(_connectionVali... | @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolean valid = true; if (!connectionMatches(virtualHost, VIRTUALH... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... |
@Test public void testLinkStealing() { _virtualHost.createChild(Queue.class, Collections.singletonMap(Queue.NAME, QUEUE_NAME)); Attach attach = createQueueAttach(true, getTestName(), QUEUE_NAME); AMQPConnection_1_0 connection1 = _connection; Session_1_0 session1 = _session; session1.receiveAttach(attach); Link_1_0<?,?>... | public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inputHandleToEndpoint.containsKey(inputHandle)) { String errorMessage = String.format("Input Handle '%d' already in use", inputHandle.intValue()); getCon... | Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget_1_0> implements LogSubject, org.apache.qpid.server.util.Deletable<Session_1_0> { public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inpu... | Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget_1_0> implements LogSubject, org.apache.qpid.server.util.Deletable<Session_1_0> { public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inpu... | Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget_1_0> implements LogSubject, org.apache.qpid.server.util.Deletable<Session_1_0> { public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inpu... | Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget_1_0> implements LogSubject, org.apache.qpid.server.util.Deletable<Session_1_0> { public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inpu... |
@Test public void testClientRejected() { when(_connectionMock.getClientVersion()).thenReturn("foo"); Map<String, List<String>> contextValues = new HashMap<>(); contextValues.put(ConnectionVersionValidator.VIRTUALHOST_REJECTED_CONNECTION_VERSION, Arrays.asList("foo")); setContextValues(contextValues); assertFalse(_conne... | @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolean valid = true; if (!connectionMatches(virtualHost, VIRTUALH... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... |
@Test public void testClientLogged() { when(_connectionMock.getClientVersion()).thenReturn("foo"); Map<String, List<String>> contextValues = new HashMap<>(); contextValues.put(ConnectionVersionValidator.VIRTUALHOST_LOGGED_CONNECTION_VERSION, Arrays.asList("foo")); setContextValues(contextValues); assertTrue(_connection... | @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolean valid = true; if (!connectionMatches(virtualHost, VIRTUALH... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... |
@Test public void testAllowedTakesPrecedence() { when(_connectionMock.getClientVersion()).thenReturn("foo"); Map<String, List<String>> contextValues = new HashMap<>(); contextValues.put(ConnectionVersionValidator.VIRTUALHOST_ALLOWED_CONNECTION_VERSION, Arrays.asList("foo")); contextValues.put(ConnectionVersionValidator... | @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolean valid = true; if (!connectionMatches(virtualHost, VIRTUALH... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... |
@Test public void testLoggedTakesPrecedenceOverRejected() { when(_connectionMock.getClientVersion()).thenReturn("foo"); Map<String, List<String>> contextValues = new HashMap<>(); contextValues.put(ConnectionVersionValidator.VIRTUALHOST_LOGGED_CONNECTION_VERSION, Arrays.asList("foo")); contextValues.put(ConnectionVersio... | @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolean valid = true; if (!connectionMatches(virtualHost, VIRTUALH... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... |
@Test public void testRegex() { Map<String, List<String>> contextValues = new HashMap<>(); contextValues.put(ConnectionVersionValidator.VIRTUALHOST_ALLOWED_CONNECTION_VERSION, Arrays.asList("foo")); contextValues.put(ConnectionVersionValidator.VIRTUALHOST_LOGGED_CONNECTION_VERSION, Arrays.asList("f.*")); setContextValu... | @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolean valid = true; if (!connectionMatches(virtualHost, VIRTUALH... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... |
@Test public void testRegexLists() { Map<String, List<String>> contextValues = new HashMap<>(); contextValues.put(ConnectionVersionValidator.VIRTUALHOST_ALLOWED_CONNECTION_VERSION, Arrays.asList("foo")); contextValues.put(ConnectionVersionValidator.VIRTUALHOST_LOGGED_CONNECTION_VERSION, Arrays.asList("f.*", "baz")); se... | @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolean valid = true; if (!connectionMatches(virtualHost, VIRTUALH... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... | ConnectionVersionValidator implements ConnectionValidator { @Override public boolean validateConnectionCreation(final AMQPConnection<?> connection, final QueueManagingVirtualHost<?> virtualHost) { String connectionVersion = connection.getClientVersion(); if (connectionVersion == null) { connectionVersion = ""; } boolea... |
@Test public void testFilterEntries_empty() { String[] enabled = {}; String[] supported = {}; List<String> allowList = Arrays.asList(); List<String> denyList = Arrays.asList(); String[] result = SSLUtil.filterEntries(enabled, supported, allowList, denyList); assertEquals("filtered list is not empty", (long) 0, (long) r... | static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(Arrays.asL... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... |
@Test public void testFilterEntries_allowListNotEmpty_denyListEmpty() { List<String> allowList = Arrays.asList("TLSv1\\.[0-9]+"); List<String> denyList = Collections.emptyList(); String[] enabled = {"TLS", "TLSv1.1", "TLSv1.2", "TLSv1.3"}; String[] expected = {"TLSv1.1", "TLSv1.2", "TLSv1.3"}; String[] supported = {"SS... | static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(Arrays.asL... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... |
@Test public void testFilterEntries_allowListEmpty_denyListNotEmpty() { List<String> allowList = Arrays.asList(); List<String> denyList = Arrays.asList("TLSv1\\.[0-9]+"); String[] enabled = {"TLS", "TLSv1.1", "TLSv1.2", "TLSv1.3"}; String[] expected = {"TLS"}; String[] supported = {"SSLv3", "TLS", "TLSv1", "TLSv1.1", "... | static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(Arrays.asL... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... |
@Test public void testFilterEntries_respectOrder() { List<String> allowList = Arrays.asList("b", "c", "a"); List<String> denyList = Collections.emptyList(); String[] enabled = {"x"}; String[] expected = {"b", "c", "a"}; String[] supported = {"x", "c", "a", "xx", "b", "xxx"}; String[] result = SSLUtil.filterEntries(enab... | static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(Arrays.asL... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... |
@Test public void testRollover() { _policy.rollover(); verify(_delegate).rollover(); } | @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } } | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorServic... | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorServic... | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorServic... |
@Test public void testFilterEntries_denyListAppliesToAllowList() { List<String> allowList = Arrays.asList("a", "b"); List<String> denyList = Arrays.asList("a"); String[] enabled = {"a", "b", "c"}; String[] expected = {"b"}; String[] supported = {"a", "b", "c", "x"}; String[] result = SSLUtil.filterEntries(enabled, supp... | static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(Arrays.asL... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... |
@Test public void testFilterEntries_allowListIgnoresEnabled() { List<String> allowList = Arrays.asList("b"); List<String> denyList = Collections.emptyList(); String[] enabled = {"a"}; String[] expected = {"b"}; String[] supported = {"a", "b", "x"}; String[] result = SSLUtil.filterEntries(enabled, supported, allowList, ... | static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(Arrays.asL... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... | SSLUtil { static String[] filterEntries(final String[] enabledEntries, final String[] supportedEntries, final List<String> allowList, final List<String> denyList) { List<String> filteredList; if (allowList != null && !allowList.isEmpty()) { filteredList = new ArrayList<>(); List<String> supportedList = new ArrayList<>(... |
@Test public void testGetIdFromSubjectDN() { assertEquals("user@somewhere.example.org", SSLUtil.getIdFromSubjectDN("cn=user,dc=somewhere,dc=example,dc=org")); assertEquals("user2@somewhere.example.org", SSLUtil.getIdFromSubjectDN("DC=somewhere, dc=example,cn=\"user2\",dc=org")); assertEquals("user@somewhere.example.org... | public static String getIdFromSubjectDN(String dn) { String cnStr = null; String dcStr = null; if(dn == null) { return ""; } else { try { LdapName ln = new LdapName(dn); for(Rdn rdn : ln.getRdns()) { if("CN".equalsIgnoreCase(rdn.getType())) { cnStr = rdn.getValue().toString(); } else if("DC".equalsIgnoreCase(rdn.getTyp... | SSLUtil { public static String getIdFromSubjectDN(String dn) { String cnStr = null; String dcStr = null; if(dn == null) { return ""; } else { try { LdapName ln = new LdapName(dn); for(Rdn rdn : ln.getRdns()) { if("CN".equalsIgnoreCase(rdn.getType())) { cnStr = rdn.getValue().toString(); } else if("DC".equalsIgnoreCase(... | SSLUtil { public static String getIdFromSubjectDN(String dn) { String cnStr = null; String dcStr = null; if(dn == null) { return ""; } else { try { LdapName ln = new LdapName(dn); for(Rdn rdn : ln.getRdns()) { if("CN".equalsIgnoreCase(rdn.getType())) { cnStr = rdn.getValue().toString(); } else if("DC".equalsIgnoreCase(... | SSLUtil { public static String getIdFromSubjectDN(String dn) { String cnStr = null; String dcStr = null; if(dn == null) { return ""; } else { try { LdapName ln = new LdapName(dn); for(Rdn rdn : ln.getRdns()) { if("CN".equalsIgnoreCase(rdn.getType())) { cnStr = rdn.getValue().toString(); } else if("DC".equalsIgnoreCase(... | SSLUtil { public static String getIdFromSubjectDN(String dn) { String cnStr = null; String dcStr = null; if(dn == null) { return ""; } else { try { LdapName ln = new LdapName(dn); for(Rdn rdn : ln.getRdns()) { if("CN".equalsIgnoreCase(rdn.getType())) { cnStr = rdn.getValue().toString(); } else if("DC".equalsIgnoreCase(... |
@Test public void testReadCertificates() throws Exception { Certificate certificate = getTestCertificate(); assertNotNull("Certificate is not found", certificate); URL certificateURL = new URL(null, DataUrlUtils.getDataUrlForBytes(certificate.getEncoded()), new Handler()); X509Certificate[] certificates = SSLUtil.readC... | public static X509Certificate[] readCertificates(URL certFile) throws IOException, GeneralSecurityException { try (InputStream is = certFile.openStream()) { return readCertificates(is); } } | SSLUtil { public static X509Certificate[] readCertificates(URL certFile) throws IOException, GeneralSecurityException { try (InputStream is = certFile.openStream()) { return readCertificates(is); } } } | SSLUtil { public static X509Certificate[] readCertificates(URL certFile) throws IOException, GeneralSecurityException { try (InputStream is = certFile.openStream()) { return readCertificates(is); } } private SSLUtil(); } | SSLUtil { public static X509Certificate[] readCertificates(URL certFile) throws IOException, GeneralSecurityException { try (InputStream is = certFile.openStream()) { return readCertificates(is); } } private SSLUtil(); static CertificateFactory getCertificateFactory(); static void verifyHostname(SSLEngine engine,Strin... | SSLUtil { public static X509Certificate[] readCertificates(URL certFile) throws IOException, GeneralSecurityException { try (InputStream is = certFile.openStream()) { return readCertificates(is); } } private SSLUtil(); static CertificateFactory getCertificateFactory(); static void verifyHostname(SSLEngine engine,Strin... |
@Test public void testTickDuringSingleTransactionWithSchedulingDelay() throws Exception { final long timeNow = System.currentTimeMillis(); final long transactionTime = timeNow - 90; when(_dateSupplier.get()).thenReturn(transactionTime); _ticker = new TransactionTimeoutTicker(_timeoutValue, _notificationRepeatPeriod, _d... | @Override public void notifySchedulingDelay(final long schedulingDelay) { if (schedulingDelay > 0) { long accumulatedSchedulingDelay; do { accumulatedSchedulingDelay = _accumulatedSchedulingDelay.get(); } while (!_accumulatedSchedulingDelay.compareAndSet(accumulatedSchedulingDelay, accumulatedSchedulingDelay + scheduli... | TransactionTimeoutTicker implements Ticker, SchedulingDelayNotificationListener { @Override public void notifySchedulingDelay(final long schedulingDelay) { if (schedulingDelay > 0) { long accumulatedSchedulingDelay; do { accumulatedSchedulingDelay = _accumulatedSchedulingDelay.get(); } while (!_accumulatedSchedulingDel... | TransactionTimeoutTicker implements Ticker, SchedulingDelayNotificationListener { @Override public void notifySchedulingDelay(final long schedulingDelay) { if (schedulingDelay > 0) { long accumulatedSchedulingDelay; do { accumulatedSchedulingDelay = _accumulatedSchedulingDelay.get(); } while (!_accumulatedSchedulingDel... | TransactionTimeoutTicker implements Ticker, SchedulingDelayNotificationListener { @Override public void notifySchedulingDelay(final long schedulingDelay) { if (schedulingDelay > 0) { long accumulatedSchedulingDelay; do { accumulatedSchedulingDelay = _accumulatedSchedulingDelay.get(); } while (!_accumulatedSchedulingDel... | TransactionTimeoutTicker implements Ticker, SchedulingDelayNotificationListener { @Override public void notifySchedulingDelay(final long schedulingDelay) { if (schedulingDelay > 0) { long accumulatedSchedulingDelay; do { accumulatedSchedulingDelay = _accumulatedSchedulingDelay.get(); } while (!_accumulatedSchedulingDel... |
@Test public void testTicksDuringManyTransactionsWithSchedulingDelay() throws Exception { long timeNow = System.currentTimeMillis(); final long firstTransactionTime = timeNow - 10; when(_dateSupplier.get()).thenReturn(firstTransactionTime); _ticker = new TransactionTimeoutTicker(_timeoutValue, _notificationRepeatPeriod... | @Override public void notifySchedulingDelay(final long schedulingDelay) { if (schedulingDelay > 0) { long accumulatedSchedulingDelay; do { accumulatedSchedulingDelay = _accumulatedSchedulingDelay.get(); } while (!_accumulatedSchedulingDelay.compareAndSet(accumulatedSchedulingDelay, accumulatedSchedulingDelay + scheduli... | TransactionTimeoutTicker implements Ticker, SchedulingDelayNotificationListener { @Override public void notifySchedulingDelay(final long schedulingDelay) { if (schedulingDelay > 0) { long accumulatedSchedulingDelay; do { accumulatedSchedulingDelay = _accumulatedSchedulingDelay.get(); } while (!_accumulatedSchedulingDel... | TransactionTimeoutTicker implements Ticker, SchedulingDelayNotificationListener { @Override public void notifySchedulingDelay(final long schedulingDelay) { if (schedulingDelay > 0) { long accumulatedSchedulingDelay; do { accumulatedSchedulingDelay = _accumulatedSchedulingDelay.get(); } while (!_accumulatedSchedulingDel... | TransactionTimeoutTicker implements Ticker, SchedulingDelayNotificationListener { @Override public void notifySchedulingDelay(final long schedulingDelay) { if (schedulingDelay > 0) { long accumulatedSchedulingDelay; do { accumulatedSchedulingDelay = _accumulatedSchedulingDelay.get(); } while (!_accumulatedSchedulingDel... | TransactionTimeoutTicker implements Ticker, SchedulingDelayNotificationListener { @Override public void notifySchedulingDelay(final long schedulingDelay) { if (schedulingDelay > 0) { long accumulatedSchedulingDelay; do { accumulatedSchedulingDelay = _accumulatedSchedulingDelay.get(); } while (!_accumulatedSchedulingDel... |
@Test public void testInitialSystemPropertiesAreSetOnBrokerStartup() throws Exception { Map<String,Object> attributes = new HashMap<>(); attributes.put(SystemConfig.INITIAL_SYSTEM_PROPERTIES_LOCATION, _initialSystemProperties.getAbsolutePath()); attributes.put(SystemConfig.INITIAL_CONFIGURATION_LOCATION, _initialConfig... | public void startup(final Map<String,Object> systemConfigAttributes) throws Exception { final SystemOutMessageLogger systemOutMessageLogger = new SystemOutMessageLogger(); _eventLogger = new EventLogger(systemOutMessageLogger); Subject.doAs(_brokerTaskSubject, new PrivilegedExceptionAction<Object>() { @Override public ... | SystemLauncher { public void startup(final Map<String,Object> systemConfigAttributes) throws Exception { final SystemOutMessageLogger systemOutMessageLogger = new SystemOutMessageLogger(); _eventLogger = new EventLogger(systemOutMessageLogger); Subject.doAs(_brokerTaskSubject, new PrivilegedExceptionAction<Object>() { ... | SystemLauncher { public void startup(final Map<String,Object> systemConfigAttributes) throws Exception { final SystemOutMessageLogger systemOutMessageLogger = new SystemOutMessageLogger(); _eventLogger = new EventLogger(systemOutMessageLogger); Subject.doAs(_brokerTaskSubject, new PrivilegedExceptionAction<Object>() { ... | SystemLauncher { public void startup(final Map<String,Object> systemConfigAttributes) throws Exception { final SystemOutMessageLogger systemOutMessageLogger = new SystemOutMessageLogger(); _eventLogger = new EventLogger(systemOutMessageLogger); Subject.doAs(_brokerTaskSubject, new PrivilegedExceptionAction<Object>() { ... | SystemLauncher { public void startup(final Map<String,Object> systemConfigAttributes) throws Exception { final SystemOutMessageLogger systemOutMessageLogger = new SystemOutMessageLogger(); _eventLogger = new EventLogger(systemOutMessageLogger); Subject.doAs(_brokerTaskSubject, new PrivilegedExceptionAction<Object>() { ... |
@Test public void testUncompressNonZipReturnsNull() throws Exception { byte[] data = new byte[1024]; Arrays.fill(data, (byte)'a'); assertNull("Non zipped data should not uncompress", GZIPUtils.uncompressBufferToArray(ByteBuffer.wrap(data))); } | public static byte[] uncompressBufferToArray(ByteBuffer contentBuffer) { if(contentBuffer != null) { try (ByteBufferInputStream input = new ByteBufferInputStream(contentBuffer)) { return uncompressStreamToArray(input); } } else { return null; } } | GZIPUtils { public static byte[] uncompressBufferToArray(ByteBuffer contentBuffer) { if(contentBuffer != null) { try (ByteBufferInputStream input = new ByteBufferInputStream(contentBuffer)) { return uncompressStreamToArray(input); } } else { return null; } } } | GZIPUtils { public static byte[] uncompressBufferToArray(ByteBuffer contentBuffer) { if(contentBuffer != null) { try (ByteBufferInputStream input = new ByteBufferInputStream(contentBuffer)) { return uncompressStreamToArray(input); } } else { return null; } } } | GZIPUtils { public static byte[] uncompressBufferToArray(ByteBuffer contentBuffer) { if(contentBuffer != null) { try (ByteBufferInputStream input = new ByteBufferInputStream(contentBuffer)) { return uncompressStreamToArray(input); } } else { return null; } } static byte[] compressBufferToArray(ByteBuffer input); stati... | GZIPUtils { public static byte[] uncompressBufferToArray(ByteBuffer contentBuffer) { if(contentBuffer != null) { try (ByteBufferInputStream input = new ByteBufferInputStream(contentBuffer)) { return uncompressStreamToArray(input); } } else { return null; } } static byte[] compressBufferToArray(ByteBuffer input); stati... |
@Test public void testUncompressStreamWithErrorReturnsNull() throws Exception { InputStream is = new InputStream() { @Override public int read() throws IOException { throw new IOException(); } }; assertNull("Stream error should return null", GZIPUtils.uncompressStreamToArray(is)); } | public static byte[] uncompressStreamToArray(InputStream stream) { if(stream != null) { try (GZIPInputStream gzipInputStream = new GZIPInputStream(stream)) { ByteArrayOutputStream inflatedContent = new ByteArrayOutputStream(); int read; byte[] buf = new byte[4096]; while ((read = gzipInputStream.read(buf)) != -1) { inf... | GZIPUtils { public static byte[] uncompressStreamToArray(InputStream stream) { if(stream != null) { try (GZIPInputStream gzipInputStream = new GZIPInputStream(stream)) { ByteArrayOutputStream inflatedContent = new ByteArrayOutputStream(); int read; byte[] buf = new byte[4096]; while ((read = gzipInputStream.read(buf)) ... | GZIPUtils { public static byte[] uncompressStreamToArray(InputStream stream) { if(stream != null) { try (GZIPInputStream gzipInputStream = new GZIPInputStream(stream)) { ByteArrayOutputStream inflatedContent = new ByteArrayOutputStream(); int read; byte[] buf = new byte[4096]; while ((read = gzipInputStream.read(buf)) ... | GZIPUtils { public static byte[] uncompressStreamToArray(InputStream stream) { if(stream != null) { try (GZIPInputStream gzipInputStream = new GZIPInputStream(stream)) { ByteArrayOutputStream inflatedContent = new ByteArrayOutputStream(); int read; byte[] buf = new byte[4096]; while ((read = gzipInputStream.read(buf)) ... | GZIPUtils { public static byte[] uncompressStreamToArray(InputStream stream) { if(stream != null) { try (GZIPInputStream gzipInputStream = new GZIPInputStream(stream)) { ByteArrayOutputStream inflatedContent = new ByteArrayOutputStream(); int read; byte[] buf = new byte[4096]; while ((read = gzipInputStream.read(buf)) ... |
@Test public void testUncompressNullStreamReturnsNull() throws Exception { assertNull("Null Stream should return null", GZIPUtils.uncompressStreamToArray(null)); } | public static byte[] uncompressStreamToArray(InputStream stream) { if(stream != null) { try (GZIPInputStream gzipInputStream = new GZIPInputStream(stream)) { ByteArrayOutputStream inflatedContent = new ByteArrayOutputStream(); int read; byte[] buf = new byte[4096]; while ((read = gzipInputStream.read(buf)) != -1) { inf... | GZIPUtils { public static byte[] uncompressStreamToArray(InputStream stream) { if(stream != null) { try (GZIPInputStream gzipInputStream = new GZIPInputStream(stream)) { ByteArrayOutputStream inflatedContent = new ByteArrayOutputStream(); int read; byte[] buf = new byte[4096]; while ((read = gzipInputStream.read(buf)) ... | GZIPUtils { public static byte[] uncompressStreamToArray(InputStream stream) { if(stream != null) { try (GZIPInputStream gzipInputStream = new GZIPInputStream(stream)) { ByteArrayOutputStream inflatedContent = new ByteArrayOutputStream(); int read; byte[] buf = new byte[4096]; while ((read = gzipInputStream.read(buf)) ... | GZIPUtils { public static byte[] uncompressStreamToArray(InputStream stream) { if(stream != null) { try (GZIPInputStream gzipInputStream = new GZIPInputStream(stream)) { ByteArrayOutputStream inflatedContent = new ByteArrayOutputStream(); int read; byte[] buf = new byte[4096]; while ((read = gzipInputStream.read(buf)) ... | GZIPUtils { public static byte[] uncompressStreamToArray(InputStream stream) { if(stream != null) { try (GZIPInputStream gzipInputStream = new GZIPInputStream(stream)) { ByteArrayOutputStream inflatedContent = new ByteArrayOutputStream(); int read; byte[] buf = new byte[4096]; while ((read = gzipInputStream.read(buf)) ... |
@Test public void testRolloverListener() throws InterruptedException { _policy.rollover(); verify(_listener).onRollover(any(Path.class), any(String[].class)); } | @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } } | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorServic... | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorServic... | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorServic... |
@Test public void testUncompressNullBufferReturnsNull() throws Exception { assertNull("Null buffer should return null", GZIPUtils.uncompressBufferToArray(null)); } | public static byte[] uncompressBufferToArray(ByteBuffer contentBuffer) { if(contentBuffer != null) { try (ByteBufferInputStream input = new ByteBufferInputStream(contentBuffer)) { return uncompressStreamToArray(input); } } else { return null; } } | GZIPUtils { public static byte[] uncompressBufferToArray(ByteBuffer contentBuffer) { if(contentBuffer != null) { try (ByteBufferInputStream input = new ByteBufferInputStream(contentBuffer)) { return uncompressStreamToArray(input); } } else { return null; } } } | GZIPUtils { public static byte[] uncompressBufferToArray(ByteBuffer contentBuffer) { if(contentBuffer != null) { try (ByteBufferInputStream input = new ByteBufferInputStream(contentBuffer)) { return uncompressStreamToArray(input); } } else { return null; } } } | GZIPUtils { public static byte[] uncompressBufferToArray(ByteBuffer contentBuffer) { if(contentBuffer != null) { try (ByteBufferInputStream input = new ByteBufferInputStream(contentBuffer)) { return uncompressStreamToArray(input); } } else { return null; } } static byte[] compressBufferToArray(ByteBuffer input); stati... | GZIPUtils { public static byte[] uncompressBufferToArray(ByteBuffer contentBuffer) { if(contentBuffer != null) { try (ByteBufferInputStream input = new ByteBufferInputStream(contentBuffer)) { return uncompressStreamToArray(input); } } else { return null; } } static byte[] compressBufferToArray(ByteBuffer input); stati... |
@Test public void testCompressNullArrayReturnsNull() { assertNull(GZIPUtils.compressBufferToArray(null)); } | public static byte[] compressBufferToArray(ByteBuffer input) { if(input != null) { try (ByteArrayOutputStream compressedBuffer = new ByteArrayOutputStream()) { try (GZIPOutputStream gzipOutputStream = new GZIPOutputStream(compressedBuffer)) { if (input.hasArray()) { gzipOutputStream.write(input.array(), input.arrayOffs... | GZIPUtils { public static byte[] compressBufferToArray(ByteBuffer input) { if(input != null) { try (ByteArrayOutputStream compressedBuffer = new ByteArrayOutputStream()) { try (GZIPOutputStream gzipOutputStream = new GZIPOutputStream(compressedBuffer)) { if (input.hasArray()) { gzipOutputStream.write(input.array(), inp... | GZIPUtils { public static byte[] compressBufferToArray(ByteBuffer input) { if(input != null) { try (ByteArrayOutputStream compressedBuffer = new ByteArrayOutputStream()) { try (GZIPOutputStream gzipOutputStream = new GZIPOutputStream(compressedBuffer)) { if (input.hasArray()) { gzipOutputStream.write(input.array(), inp... | GZIPUtils { public static byte[] compressBufferToArray(ByteBuffer input) { if(input != null) { try (ByteArrayOutputStream compressedBuffer = new ByteArrayOutputStream()) { try (GZIPOutputStream gzipOutputStream = new GZIPOutputStream(compressedBuffer)) { if (input.hasArray()) { gzipOutputStream.write(input.array(), inp... | GZIPUtils { public static byte[] compressBufferToArray(ByteBuffer input) { if(input != null) { try (ByteArrayOutputStream compressedBuffer = new ByteArrayOutputStream()) { try (GZIPOutputStream gzipOutputStream = new GZIPOutputStream(compressedBuffer)) { if (input.hasArray()) { gzipOutputStream.write(input.array(), inp... |
@Test public void testCreateNewFile() throws Exception { assertFalse("File should not exist", _testFile.exists()); Path path = _fileHelper.createNewFile(_testFile, TEST_FILE_PERMISSIONS); assertTrue("File was not created", path.toFile().exists()); if (Files.getFileAttributeView(path, PosixFileAttributeView.class) != nu... | public Path createNewFile(File newFile, String posixFileAttributes) throws IOException { return createNewFile(newFile.toPath(), posixFileAttributes); } | FileHelper { public Path createNewFile(File newFile, String posixFileAttributes) throws IOException { return createNewFile(newFile.toPath(), posixFileAttributes); } } | FileHelper { public Path createNewFile(File newFile, String posixFileAttributes) throws IOException { return createNewFile(newFile.toPath(), posixFileAttributes); } } | FileHelper { public Path createNewFile(File newFile, String posixFileAttributes) throws IOException { return createNewFile(newFile.toPath(), posixFileAttributes); } void writeFileSafely(Path targetFile, BaseAction<File, IOException> operation); void writeFileSafely(Path targetFile, Path backupFile, Path tmpFile, BaseA... | FileHelper { public Path createNewFile(File newFile, String posixFileAttributes) throws IOException { return createNewFile(newFile.toPath(), posixFileAttributes); } void writeFileSafely(Path targetFile, BaseAction<File, IOException> operation); void writeFileSafely(Path targetFile, Path backupFile, Path tmpFile, BaseA... |
@Test public void testCreateNewFileUsingRelativePath() throws Exception { _testFile = new File("./tmp-" + System.currentTimeMillis()); assertFalse("File should not exist", _testFile.exists()); Path path = _fileHelper.createNewFile(_testFile, TEST_FILE_PERMISSIONS); assertTrue("File was not created", path.toFile().exist... | public Path createNewFile(File newFile, String posixFileAttributes) throws IOException { return createNewFile(newFile.toPath(), posixFileAttributes); } | FileHelper { public Path createNewFile(File newFile, String posixFileAttributes) throws IOException { return createNewFile(newFile.toPath(), posixFileAttributes); } } | FileHelper { public Path createNewFile(File newFile, String posixFileAttributes) throws IOException { return createNewFile(newFile.toPath(), posixFileAttributes); } } | FileHelper { public Path createNewFile(File newFile, String posixFileAttributes) throws IOException { return createNewFile(newFile.toPath(), posixFileAttributes); } void writeFileSafely(Path targetFile, BaseAction<File, IOException> operation); void writeFileSafely(Path targetFile, Path backupFile, Path tmpFile, BaseA... | FileHelper { public Path createNewFile(File newFile, String posixFileAttributes) throws IOException { return createNewFile(newFile.toPath(), posixFileAttributes); } void writeFileSafely(Path targetFile, BaseAction<File, IOException> operation); void writeFileSafely(Path targetFile, Path backupFile, Path tmpFile, BaseA... |
@Test public void testWriteFileSafely() throws Exception { Path path = _fileHelper.createNewFile(_testFile, TEST_FILE_PERMISSIONS); _fileHelper.writeFileSafely(path, new BaseAction<File, IOException>() { @Override public void performAction(File file) throws IOException { Files.write(file.toPath(), "test".getBytes("UTF8... | public void writeFileSafely(Path targetFile, BaseAction<File, IOException> operation) throws IOException { String name = targetFile.toFile().getName(); writeFileSafely(targetFile, targetFile.resolveSibling(name + ".bak"), targetFile.resolveSibling(name + ".tmp"), operation); } | FileHelper { public void writeFileSafely(Path targetFile, BaseAction<File, IOException> operation) throws IOException { String name = targetFile.toFile().getName(); writeFileSafely(targetFile, targetFile.resolveSibling(name + ".bak"), targetFile.resolveSibling(name + ".tmp"), operation); } } | FileHelper { public void writeFileSafely(Path targetFile, BaseAction<File, IOException> operation) throws IOException { String name = targetFile.toFile().getName(); writeFileSafely(targetFile, targetFile.resolveSibling(name + ".bak"), targetFile.resolveSibling(name + ".tmp"), operation); } } | FileHelper { public void writeFileSafely(Path targetFile, BaseAction<File, IOException> operation) throws IOException { String name = targetFile.toFile().getName(); writeFileSafely(targetFile, targetFile.resolveSibling(name + ".bak"), targetFile.resolveSibling(name + ".tmp"), operation); } void writeFileSafely(Path ta... | FileHelper { public void writeFileSafely(Path targetFile, BaseAction<File, IOException> operation) throws IOException { String name = targetFile.toFile().getName(); writeFileSafely(targetFile, targetFile.resolveSibling(name + ".bak"), targetFile.resolveSibling(name + ".tmp"), operation); } void writeFileSafely(Path ta... |
@Test public void testAtomicFileMoveOrReplace() throws Exception { Path path = _fileHelper.createNewFile(_testFile, TEST_FILE_PERMISSIONS); Files.write(path, "test".getBytes("UTF8")); _testFile = _fileHelper.atomicFileMoveOrReplace(path, path.resolveSibling(_testFile.getName() + ".target")).toFile(); assertFalse("File ... | public Path atomicFileMoveOrReplace(Path sourceFile, Path targetFile) throws IOException { try { return Files.move(sourceFile, targetFile, StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING); } catch(AtomicMoveNotSupportedException e) { if (sourceFile.toFile().renameTo(targetFile.toFile())) { return ta... | FileHelper { public Path atomicFileMoveOrReplace(Path sourceFile, Path targetFile) throws IOException { try { return Files.move(sourceFile, targetFile, StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING); } catch(AtomicMoveNotSupportedException e) { if (sourceFile.toFile().renameTo(targetFile.toFile())... | FileHelper { public Path atomicFileMoveOrReplace(Path sourceFile, Path targetFile) throws IOException { try { return Files.move(sourceFile, targetFile, StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING); } catch(AtomicMoveNotSupportedException e) { if (sourceFile.toFile().renameTo(targetFile.toFile())... | FileHelper { public Path atomicFileMoveOrReplace(Path sourceFile, Path targetFile) throws IOException { try { return Files.move(sourceFile, targetFile, StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING); } catch(AtomicMoveNotSupportedException e) { if (sourceFile.toFile().renameTo(targetFile.toFile())... | FileHelper { public Path atomicFileMoveOrReplace(Path sourceFile, Path targetFile) throws IOException { try { return Files.move(sourceFile, targetFile, StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING); } catch(AtomicMoveNotSupportedException e) { if (sourceFile.toFile().renameTo(targetFile.toFile())... |
@Test public void testIsWritableDirectoryForNonWritablePath() throws Exception { File workDir = TestFileUtils.createTestDirectory("test", true); try { if (Files.getFileAttributeView(workDir.toPath(), PosixFileAttributeView.class) != null) { File file = new File(workDir, getTestName()); file.mkdirs(); if (file.setWritab... | public boolean isWritableDirectory(String path) { File storePath = new File(path).getAbsoluteFile(); if (storePath.exists()) { if (!storePath.isDirectory()) { return false; } } else { do { storePath = storePath.getParentFile(); if (storePath == null) { return false; } } while (!storePath.exists()); } return storePath.c... | FileHelper { public boolean isWritableDirectory(String path) { File storePath = new File(path).getAbsoluteFile(); if (storePath.exists()) { if (!storePath.isDirectory()) { return false; } } else { do { storePath = storePath.getParentFile(); if (storePath == null) { return false; } } while (!storePath.exists()); } retur... | FileHelper { public boolean isWritableDirectory(String path) { File storePath = new File(path).getAbsoluteFile(); if (storePath.exists()) { if (!storePath.isDirectory()) { return false; } } else { do { storePath = storePath.getParentFile(); if (storePath == null) { return false; } } while (!storePath.exists()); } retur... | FileHelper { public boolean isWritableDirectory(String path) { File storePath = new File(path).getAbsoluteFile(); if (storePath.exists()) { if (!storePath.isDirectory()) { return false; } } else { do { storePath = storePath.getParentFile(); if (storePath == null) { return false; } } while (!storePath.exists()); } retur... | FileHelper { public boolean isWritableDirectory(String path) { File storePath = new File(path).getAbsoluteFile(); if (storePath.exists()) { if (!storePath.isDirectory()) { return false; } } else { do { storePath = storePath.getParentFile(); if (storePath == null) { return false; } } while (!storePath.exists()); } retur... |
@Test public void hexDumpSingleByte() { String expected = String.format("0000000 41%n" + "0000001%n"); String actual = Strings.hexDump(ByteBuffer.wrap("A".getBytes())); assertThat(actual, is(equalTo(expected))); } | public static String hexDump(ByteBuffer buf) { StringBuilder builder = new StringBuilder(); int count = 0; for(int p = buf.position(); p < buf.position() + buf.remaining(); p++) { if (count % 16 == 0) { if (count > 0) { builder.append(String.format("%n")); } builder.append(String.format("%07x ", count)); } builder.appe... | Strings { public static String hexDump(ByteBuffer buf) { StringBuilder builder = new StringBuilder(); int count = 0; for(int p = buf.position(); p < buf.position() + buf.remaining(); p++) { if (count % 16 == 0) { if (count > 0) { builder.append(String.format("%n")); } builder.append(String.format("%07x ", count)); } bu... | Strings { public static String hexDump(ByteBuffer buf) { StringBuilder builder = new StringBuilder(); int count = 0; for(int p = buf.position(); p < buf.position() + buf.remaining(); p++) { if (count % 16 == 0) { if (count > 0) { builder.append(String.format("%n")); } builder.append(String.format("%07x ", count)); } bu... | Strings { public static String hexDump(ByteBuffer buf) { StringBuilder builder = new StringBuilder(); int count = 0; for(int p = buf.position(); p < buf.position() + buf.remaining(); p++) { if (count % 16 == 0) { if (count > 0) { builder.append(String.format("%n")); } builder.append(String.format("%07x ", count)); } bu... | Strings { public static String hexDump(ByteBuffer buf) { StringBuilder builder = new StringBuilder(); int count = 0; for(int p = buf.position(); p < buf.position() + buf.remaining(); p++) { if (count % 16 == 0) { if (count > 0) { builder.append(String.format("%n")); } builder.append(String.format("%07x ", count)); } bu... |
@Test public void hexDumpManyBytes() { String expected = String.format("0000000 31 32 33 34 35 36 37 38 31 32 33 34 35 36 37 38%n" + "0000010 39%n" + "0000011%n"); String actual = Strings.hexDump(ByteBuffer.wrap("12345678123456789".getBytes())); assertThat(actual, is(equalTo(expected))); } | public static String hexDump(ByteBuffer buf) { StringBuilder builder = new StringBuilder(); int count = 0; for(int p = buf.position(); p < buf.position() + buf.remaining(); p++) { if (count % 16 == 0) { if (count > 0) { builder.append(String.format("%n")); } builder.append(String.format("%07x ", count)); } builder.appe... | Strings { public static String hexDump(ByteBuffer buf) { StringBuilder builder = new StringBuilder(); int count = 0; for(int p = buf.position(); p < buf.position() + buf.remaining(); p++) { if (count % 16 == 0) { if (count > 0) { builder.append(String.format("%n")); } builder.append(String.format("%07x ", count)); } bu... | Strings { public static String hexDump(ByteBuffer buf) { StringBuilder builder = new StringBuilder(); int count = 0; for(int p = buf.position(); p < buf.position() + buf.remaining(); p++) { if (count % 16 == 0) { if (count > 0) { builder.append(String.format("%n")); } builder.append(String.format("%07x ", count)); } bu... | Strings { public static String hexDump(ByteBuffer buf) { StringBuilder builder = new StringBuilder(); int count = 0; for(int p = buf.position(); p < buf.position() + buf.remaining(); p++) { if (count % 16 == 0) { if (count > 0) { builder.append(String.format("%n")); } builder.append(String.format("%07x ", count)); } bu... | Strings { public static String hexDump(ByteBuffer buf) { StringBuilder builder = new StringBuilder(); int count = 0; for(int p = buf.position(); p < buf.position() + buf.remaining(); p++) { if (count % 16 == 0) { if (count > 0) { builder.append(String.format("%n")); } builder.append(String.format("%07x ", count)); } bu... |
@Test public void testGetOptionsInForceReturnsEmptyStringBeforeParsing() throws Exception { CommandLineParser parser = new CommandLineParser( new String[][] { { "t1", "Test Flag 1." }, { "t2", "Test Option 2.", "test" }, { "t3", "Test Option 3.", "test", "true" }, { "t4", "Test Option 4.", "test", null, "^test$" } }); ... | public String getOptionsInForce() { if (parsedProperties == null) { return ""; } StringBuilder result = new StringBuilder("Options in force:\n"); for (Map.Entry<Object, Object> property : parsedProperties.entrySet()) { result.append(property.getKey()) .append(" = ") .append(property.getValue()) .append('\n'); } return ... | CommandLineParser { public String getOptionsInForce() { if (parsedProperties == null) { return ""; } StringBuilder result = new StringBuilder("Options in force:\n"); for (Map.Entry<Object, Object> property : parsedProperties.entrySet()) { result.append(property.getKey()) .append(" = ") .append(property.getValue()) .app... | CommandLineParser { public String getOptionsInForce() { if (parsedProperties == null) { return ""; } StringBuilder result = new StringBuilder("Options in force:\n"); for (Map.Entry<Object, Object> property : parsedProperties.entrySet()) { result.append(property.getKey()) .append(" = ") .append(property.getValue()) .app... | CommandLineParser { public String getOptionsInForce() { if (parsedProperties == null) { return ""; } StringBuilder result = new StringBuilder("Options in force:\n"); for (Map.Entry<Object, Object> property : parsedProperties.entrySet()) { result.append(property.getKey()) .append(" = ") .append(property.getValue()) .app... | CommandLineParser { public String getOptionsInForce() { if (parsedProperties == null) { return ""; } StringBuilder result = new StringBuilder("Options in force:\n"); for (Map.Entry<Object, Object> property : parsedProperties.entrySet()) { result.append(property.getKey()) .append(" = ") .append(property.getValue()) .app... |
@Test public void testRolloverWithFile() throws IOException { _policy.rollover(); verify(_delegate).rollover(); ArgumentMatcher<String[]> matcher = getMatcher(new String[]{_testFile.getName()}); verify(_listener).onRollover(eq(_baseFolder.toPath()), argThat(matcher)); } | @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } } | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorServic... | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorServic... | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorServic... |
@Test public void testGetUsageReturnsString() throws Exception { CommandLineParser parser = new CommandLineParser( new String[][] { { "t1", "Test Flag 1." }, { "t2", "Test Option 2.", "test" }, { "t3", "Test Option 3.", "test", "true" }, { "t4", "Test Option 4.", "test", null, "^test$" } }); final boolean condition = !... | public String getUsage() { String result = "Options:\n"; for (CommandLineOption optionInfo : optionMap.values()) { result += "-" + optionInfo.option + " " + ((optionInfo.argument != null) ? (optionInfo.argument + " ") : "") + optionInfo.comment + "\n"; } return result; } | CommandLineParser { public String getUsage() { String result = "Options:\n"; for (CommandLineOption optionInfo : optionMap.values()) { result += "-" + optionInfo.option + " " + ((optionInfo.argument != null) ? (optionInfo.argument + " ") : "") + optionInfo.comment + "\n"; } return result; } } | CommandLineParser { public String getUsage() { String result = "Options:\n"; for (CommandLineOption optionInfo : optionMap.values()) { result += "-" + optionInfo.option + " " + ((optionInfo.argument != null) ? (optionInfo.argument + " ") : "") + optionInfo.comment + "\n"; } return result; } CommandLineParser(String[][]... | CommandLineParser { public String getUsage() { String result = "Options:\n"; for (CommandLineOption optionInfo : optionMap.values()) { result += "-" + optionInfo.option + " " + ((optionInfo.argument != null) ? (optionInfo.argument + " ") : "") + optionInfo.comment + "\n"; } return result; } CommandLineParser(String[][]... | CommandLineParser { public String getUsage() { String result = "Options:\n"; for (CommandLineOption optionInfo : optionMap.values()) { result += "-" + optionInfo.option + " " + ((optionInfo.argument != null) ? (optionInfo.argument + " ") : "") + optionInfo.comment + "\n"; } return result; } CommandLineParser(String[][]... |
@Test public void testParseCondensedFlagsOk() throws Exception { CommandLineParser parser = new CommandLineParser( new String[][] { { "t1", "Test Flag 1." }, { "t2", "Test Flag 2." }, { "t3", "Test Flag 3." } }); Properties testProps = parser.parseCommandLine(new String[] { "-t1t2t3" }); assertTrue("The t1 flag was not... | public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for (Iterator<String> i... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... |
@Test public void testParseFlagCondensedWithOptionFails() throws Exception { CommandLineParser parser = new CommandLineParser(new String[][] { { "t1", "Test Flag 1." }, { "t2", "Test Option 2.", "test" } }); boolean testPassed = false; try { Properties testProps = parser.parseCommandLine(new String[] { "-t1t2" }); } ca... | public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for (Iterator<String> i... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... |
@Test public void testParseFormattedFreeArgumentFailsBadArgument() throws Exception { CommandLineParser parser = new CommandLineParser(new String[][] { { "1", "Test Free Argument.", "test", null, "^test$" } }); boolean testPassed = false; try { Properties testProps = parser.parseCommandLine(new String[] { "fail" }); } ... | public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for (Iterator<String> i... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... |
@Test public void testParseFormattedFreeArgumentOk() throws Exception { CommandLineParser parser = new CommandLineParser(new String[][] { { "1", "Test Free Argument.", "test", null, "^test$" } }); Properties testProps = parser.parseCommandLine(new String[] { "test" }); assertTrue("The first free argument was not equal ... | public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for (Iterator<String> i... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... |
@Test public void testParseFormattedOptionArgumentFailsBadArgument() throws Exception { CommandLineParser parser = new CommandLineParser(new String[][] { { "t", "Test Option.", "test", null, "^test$" } }); boolean testPassed = false; try { Properties testProps = parser.parseCommandLine(new String[] { "-t", "fail" }); }... | public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for (Iterator<String> i... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... |
@Test public void testParseFormattedOptionArgumentOk() throws Exception { CommandLineParser parser = new CommandLineParser(new String[][] { { "t", "Test Option.", "test", null, "^test$" } }); Properties testProps = parser.parseCommandLine(new String[] { "-t", "test" }); assertTrue("The test option was not equal to \"te... | public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for (Iterator<String> i... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... |
@Test public void testParseFreeArgumentOk() throws Exception { CommandLineParser parser = new CommandLineParser(new String[][] { { "1", "Test Free Argument.", "test" } }); Properties testProps = parser.parseCommandLine(new String[] { "test" }); assertTrue("The first free argument was not equal to \"test\" but was: " + ... | public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for (Iterator<String> i... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... |
@Test public void testParseMandatoryOptionOk() throws Exception { CommandLineParser parser = new CommandLineParser(new String[][] { { "t", "Test Option.", "test", "true" } }); Properties testProps = parser.parseCommandLine(new String[] { "-t", "test" }); assertTrue("The test option was not equal to \"test\" but was: " ... | public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for (Iterator<String> i... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... |
@Test public void testParseMandatoryFreeArgumentOk() throws Exception { CommandLineParser parser = new CommandLineParser(new String[][] { { "1", "Test Option.", "test", "true" } }); Properties testProps = parser.parseCommandLine(new String[] { "test" }); assertTrue("The first free argument was not equal to \"test\" but... | public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for (Iterator<String> i... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... |
@Test public void testRolloverRescanLimit() throws IOException { _policy.rollover(); verify(_delegate).rollover(); ArgumentMatcher<String[]> matcher = getMatcher(new String[]{_testFile.getName()}); verify(_listener).onRollover(eq(_baseFolder.toPath()), argThat(matcher)); _policy.rollover(); verify(_delegate, times(2)).... | @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } } | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorServic... | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorServic... | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorServic... |
@Test public void testParseManadatoryFreeArgumentFailsNoArgument() throws Exception { CommandLineParser parser = new CommandLineParser(new String[][] { { "1", "Test Option.", "test", "true" } }); boolean testPassed = false; try { Properties testProps = parser.parseCommandLine(new String[] {}); } catch (IllegalArgumentE... | public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for (Iterator<String> i... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... |
@Test public void testParseMandatoryFailsNoOption() throws Exception { CommandLineParser parser = new CommandLineParser(new String[][] { { "t", "Test Option.", "test", "true" } }); boolean testPassed = false; try { Properties testProps = parser.parseCommandLine(new String[] {}); } catch (IllegalArgumentException e) { t... | public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for (Iterator<String> i... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... |
@Test public void testParseOptionWithNoSpaceOk() throws Exception { CommandLineParser parser = new CommandLineParser(new String[][] { { "t", "Test Option.", "test" } }); Properties testProps = parser.parseCommandLine(new String[] { "-ttest" }); assertTrue("The test option was not equal to \"test\" but was: " + testProp... | public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for (Iterator<String> i... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... |
@Test public void testParseOptionWithSpaceOk() throws Exception { CommandLineParser parser = new CommandLineParser(new String[][] { { "t", "Test Option.", "test" } }); Properties testProps = parser.parseCommandLine(new String[] { "-t", "test" }); assertTrue("The test option was not equal to \"test\" but was: " + testPr... | public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for (Iterator<String> i... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... |
@Test public void testParseUnknownOptionOk() throws Exception { CommandLineParser parser = new CommandLineParser(new String[][] {}); try { parser.parseCommandLine(new String[] { "-t" }); } catch (IllegalArgumentException e) { fail("The parser threw an IllegalArgumentException on an unknown flag when errors on unkowns i... | public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for (Iterator<String> i... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... | CommandLineParser { public Properties parseCommandLine(String[] args) throws IllegalArgumentException { Properties options = new Properties(); int free = 1; boolean expectingArgs = false; String optionExpectingArgs = null; boolean ignore = false; StringBuilder regexp = new StringBuilder("^("); int optionsAdded = 0; for... |
@Test public void testRandomAlphaNumericStringInt() { String password = _util.randomAlphaNumericString(10); assertEquals("Unexpected password string length", (long) 10, (long) password.length()); assertCharacters(password); } | public String randomAlphaNumericString(int maxLength) { char[] result = new char[maxLength]; for (int i = 0; i < maxLength; i++) { result[i] = (char) CHARACTERS[_random.nextInt(CHARACTERS.length)]; } return new String(result); } | StringUtil { public String randomAlphaNumericString(int maxLength) { char[] result = new char[maxLength]; for (int i = 0; i < maxLength; i++) { result[i] = (char) CHARACTERS[_random.nextInt(CHARACTERS.length)]; } return new String(result); } } | StringUtil { public String randomAlphaNumericString(int maxLength) { char[] result = new char[maxLength]; for (int i = 0; i < maxLength; i++) { result[i] = (char) CHARACTERS[_random.nextInt(CHARACTERS.length)]; } return new String(result); } } | StringUtil { public String randomAlphaNumericString(int maxLength) { char[] result = new char[maxLength]; for (int i = 0; i < maxLength; i++) { result[i] = (char) CHARACTERS[_random.nextInt(CHARACTERS.length)]; } return new String(result); } static String elideDataUrl(final String path); static String toHex(byte[] bin... | StringUtil { public String randomAlphaNumericString(int maxLength) { char[] result = new char[maxLength]; for (int i = 0; i < maxLength; i++) { result[i] = (char) CHARACTERS[_random.nextInt(CHARACTERS.length)]; } return new String(result); } static String elideDataUrl(final String path); static String toHex(byte[] bin... |
@Test public void testCreateUniqueJavaName() { assertEquals("MyName_973de1b4e26b629d4817c8255090e58e", _util.createUniqueJavaName("MyName")); assertEquals("ContaisIllegalJavaCharacters_a68b2484f2eb790558d6527e56c595fa", _util.createUniqueJavaName("Contais+Illegal-Java*Characters")); assertEquals("StartsWithIllegalIniti... | public String createUniqueJavaName(String managerName) { StringBuilder builder = new StringBuilder(); boolean initialChar = true; for (int i = 0; i < managerName.length(); i++) { char c = managerName.charAt(i); if ((initialChar && Character.isJavaIdentifierStart(c)) || (!initialChar && Character.isJavaIdentifierPart(c)... | StringUtil { public String createUniqueJavaName(String managerName) { StringBuilder builder = new StringBuilder(); boolean initialChar = true; for (int i = 0; i < managerName.length(); i++) { char c = managerName.charAt(i); if ((initialChar && Character.isJavaIdentifierStart(c)) || (!initialChar && Character.isJavaIden... | StringUtil { public String createUniqueJavaName(String managerName) { StringBuilder builder = new StringBuilder(); boolean initialChar = true; for (int i = 0; i < managerName.length(); i++) { char c = managerName.charAt(i); if ((initialChar && Character.isJavaIdentifierStart(c)) || (!initialChar && Character.isJavaIden... | StringUtil { public String createUniqueJavaName(String managerName) { StringBuilder builder = new StringBuilder(); boolean initialChar = true; for (int i = 0; i < managerName.length(); i++) { char c = managerName.charAt(i); if ((initialChar && Character.isJavaIdentifierStart(c)) || (!initialChar && Character.isJavaIden... | StringUtil { public String createUniqueJavaName(String managerName) { StringBuilder builder = new StringBuilder(); boolean initialChar = true; for (int i = 0; i < managerName.length(); i++) { char c = managerName.charAt(i); if ((initialChar && Character.isJavaIdentifierStart(c)) || (!initialChar && Character.isJavaIden... |
@Test public void testCopyRecursive() { final String TEST_DATA = "FileUtilsTest-testDirectoryCopy-TestDataTestDataTestDataTestDataTestDataTestData"; String fileName = "FileUtilsTest-testCopy"; String TEST_DIR = "testDirectoryCopy"; File testDir = new File(TEST_DIR); File[] beforeCopyFileList = testDir.getAbsoluteFile()... | public static void copyRecursive(File source, File dst) throws FileNotFoundException, UnableToCopyException { if (!source.exists()) { throw new FileNotFoundException("Unable to copy '" + source.toString() + "' as it does not exist."); } if (dst.exists() && !dst.isDirectory()) { throw new IllegalArgumentException("Unabl... | FileUtils { public static void copyRecursive(File source, File dst) throws FileNotFoundException, UnableToCopyException { if (!source.exists()) { throw new FileNotFoundException("Unable to copy '" + source.toString() + "' as it does not exist."); } if (dst.exists() && !dst.isDirectory()) { throw new IllegalArgumentExce... | FileUtils { public static void copyRecursive(File source, File dst) throws FileNotFoundException, UnableToCopyException { if (!source.exists()) { throw new FileNotFoundException("Unable to copy '" + source.toString() + "' as it does not exist."); } if (dst.exists() && !dst.isDirectory()) { throw new IllegalArgumentExce... | FileUtils { public static void copyRecursive(File source, File dst) throws FileNotFoundException, UnableToCopyException { if (!source.exists()) { throw new FileNotFoundException("Unable to copy '" + source.toString() + "' as it does not exist."); } if (dst.exists() && !dst.isDirectory()) { throw new IllegalArgumentExce... | FileUtils { public static void copyRecursive(File source, File dst) throws FileNotFoundException, UnableToCopyException { if (!source.exists()) { throw new FileNotFoundException("Unable to copy '" + source.toString() + "' as it does not exist."); } if (dst.exists() && !dst.isDirectory()) { throw new IllegalArgumentExce... |
@Test public void testDeleteFile() { File test = new File("FileUtilsTest-testDelete"); String path = test.getAbsolutePath(); File[] filesBefore = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles(); int fileCountBefore = filesBefore.length; try { test.createNewFile(); test.deleteOnExit(); } catch ... | public static boolean deleteFile(String filePath) { return delete(new File(filePath), false); } | FileUtils { public static boolean deleteFile(String filePath) { return delete(new File(filePath), false); } } | FileUtils { public static boolean deleteFile(String filePath) { return delete(new File(filePath), false); } private FileUtils(); } | FileUtils { public static boolean deleteFile(String filePath) { return delete(new File(filePath), false); } private FileUtils(); static byte[] readFileAsBytes(String filename); static String readFileAsString(String filename); static String readFileAsString(File file); @SuppressWarnings("resource") static InputStream o... | FileUtils { public static boolean deleteFile(String filePath) { return delete(new File(filePath), false); } private FileUtils(); static byte[] readFileAsBytes(String filename); static String readFileAsString(String filename); static String readFileAsString(File file); @SuppressWarnings("resource") static InputStream o... |
@Test public void testDeleteNonExistentFile() { File test = new File("FileUtilsTest-testDelete-" + System.currentTimeMillis()); final boolean condition1 = !test.exists(); assertTrue("File exists", condition1); assertFalse("File is a directory", test.isDirectory()); final boolean condition = !FileUtils.delete(test, true... | public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) { success = d... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... |
@Test public void testSequentialRollover() throws IOException { _policy.rollover(); verify(_delegate).rollover(); ArgumentMatcher<String[]> matcher = getMatcher(new String[]{ _testFile.getName() }); verify(_listener).onRollover(eq(_baseFolder.toPath()), argThat(matcher)); File secondFile = createTestFile("test.2015-06-... | @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } } | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorServic... | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorServic... | RollingPolicyDecorator implements RollingPolicy { @Override public void rollover() throws RolloverFailure { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.rollover(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorServic... |
@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 InternalMessage conve... | @Override public InternalMessage convert(Message_1_0 serverMessage, NamedAddressSpace addressSpace) { Object bodyObject = MessageConverter_from_1_0.convertBodyToObject(serverMessage); final AMQMessageHeader convertHeader = convertHeader(serverMessage, addressSpace, bodyObject); return InternalMessage.convert(serverMess... | 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... | 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... | 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... | 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 testDeleteNull() { try { FileUtils.delete(null, true); fail("Delete with null value should throw NPE."); } catch (NullPointerException npe) { } } | public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) { success = d... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... |
@Test public void testOpenFileOrDefaultResourceOpensFileOnFileSystem() throws Exception { final File testFile = createTestFileInTmpDir("src=tmpfile"); final String filenameOnFilesystem = testFile.getCanonicalPath(); final String defaultResource = "org/apache/qpid/util/default.properties"; final InputStream is = FileUti... | @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = null; } if (is... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... |
@Test public void testOpenFileOrDefaultResourceOpensFileOnClasspath() throws Exception { final String mydefaultsResource = "org/apache/qpid/server/util/mydefaults.properties"; final String defaultResource = "org/apache/qpid/server/util/default.properties"; final InputStream is = FileUtils.openFileOrDefaultResource(myde... | @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = null; } if (is... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... |
@Test public void testOpenFileOrDefaultResourceOpensDefaultResource() throws Exception { final File fileThatDoesNotExist = new File("/does/not/exist.properties"); assertFalse("Test must not exist", fileThatDoesNotExist.exists()); final String defaultResource = "org/apache/qpid/server/util/default.properties"; final Inp... | @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = null; } if (is... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... |
@Test public void testOpenFileOrDefaultResourceReturnsNullWhenNeitherCanBeFound() throws Exception { final String mydefaultsResource = "org/apache/qpid/server/util/doesnotexisteiether.properties"; final String defaultResource = "org/apache/qpid/server/util/doesnotexisteiether.properties"; final InputStream is = FileUti... | @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = null; } if (is... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... | FileUtils { @SuppressWarnings("resource") public static InputStream openFileOrDefaultResource(String filename, String defaultResource, ClassLoader cl) { InputStream is = null; if (filename != null) { try { is = new BufferedInputStream(new FileInputStream(new File(filename))); } catch (FileNotFoundException e) { is = nu... |
@Test public void testEmptyDirectoryDelete() { String directoryName = "FileUtilsTest-testRecursiveDelete"; File test = new File(directoryName); String path = test.getAbsolutePath(); File[] filesBefore = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles(); int fileCountBefore = filesBefore.length; ... | public static boolean deleteDirectory(String directoryPath) { File directory = new File(directoryPath); if (directory.isDirectory()) { if (directory.listFiles().length == 0) { return delete(directory, true); } } return false; } | FileUtils { public static boolean deleteDirectory(String directoryPath) { File directory = new File(directoryPath); if (directory.isDirectory()) { if (directory.listFiles().length == 0) { return delete(directory, true); } } return false; } } | FileUtils { public static boolean deleteDirectory(String directoryPath) { File directory = new File(directoryPath); if (directory.isDirectory()) { if (directory.listFiles().length == 0) { return delete(directory, true); } } return false; } private FileUtils(); } | FileUtils { public static boolean deleteDirectory(String directoryPath) { File directory = new File(directoryPath); if (directory.isDirectory()) { if (directory.listFiles().length == 0) { return delete(directory, true); } } return false; } private FileUtils(); static byte[] readFileAsBytes(String filename); static Str... | FileUtils { public static boolean deleteDirectory(String directoryPath) { File directory = new File(directoryPath); if (directory.isDirectory()) { if (directory.listFiles().length == 0) { return delete(directory, true); } } return false; } private FileUtils(); static byte[] readFileAsBytes(String filename); static Str... |
@Test public void testNonEmptyDirectoryDelete() { String directoryName = "FileUtilsTest-testRecursiveDelete"; File test = new File(directoryName); final boolean condition = !test.exists(); assertTrue("Directory exists", condition); String path = test.getAbsolutePath(); File[] filesBefore = new File(path.substring(0, pa... | public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) { success = d... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... |
@Test public void testRecursiveDelete() { String directoryName = "FileUtilsTest-testRecursiveDelete"; File test = new File(directoryName); final boolean condition1 = !test.exists(); assertTrue("Directory exists", condition1); String path = test.getAbsolutePath(); File[] filesBefore = new File(path.substring(0, path.las... | public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) { success = d... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... | FileUtils { public static boolean delete(File file, boolean recursive) { boolean success = true; if (file.isDirectory()) { if (recursive) { File[] files = file.listFiles(); if (files == null) { LOG.debug("Recursive delete failed as file was deleted outside JVM"); return false; } for (int i = 0; i < files.length; i++) {... |
@Test public void testUuidFromBits() { UUID first = _factory.createUuidFromBits(0L,0L); UUID second = _factory.createUuidFromBits(0L,0L); assertSame("UUIDFactory should return the same object", first, second); } | public UUID createUuidFromBits(final long mostSigBits, final long leastSigBits) { UUID candidate = new UUID(mostSigBits, leastSigBits); return cacheIfNecessary(candidate); } | CachingUUIDFactory { public UUID createUuidFromBits(final long mostSigBits, final long leastSigBits) { UUID candidate = new UUID(mostSigBits, leastSigBits); return cacheIfNecessary(candidate); } } | CachingUUIDFactory { public UUID createUuidFromBits(final long mostSigBits, final long leastSigBits) { UUID candidate = new UUID(mostSigBits, leastSigBits); return cacheIfNecessary(candidate); } } | CachingUUIDFactory { public UUID createUuidFromBits(final long mostSigBits, final long leastSigBits) { UUID candidate = new UUID(mostSigBits, leastSigBits); return cacheIfNecessary(candidate); } UUID createUuidFromString(final String name); UUID createUuidFromBits(final long mostSigBits, final long leastSigBits); } | CachingUUIDFactory { public UUID createUuidFromBits(final long mostSigBits, final long leastSigBits) { UUID candidate = new UUID(mostSigBits, leastSigBits); return cacheIfNecessary(candidate); } UUID createUuidFromString(final String name); UUID createUuidFromBits(final long mostSigBits, final long leastSigBits); } |
@Test public void testRead() throws IOException { for (int i = 0; i < _data.length; i++) { assertEquals("Unexpected byte at position " + i, (long) _data[i], (long) _inputStream.read()); } assertEquals("EOF not reached", (long) -1, (long) _inputStream.read()); } | @Override public int read() throws IOException { if (_buffer.hasRemaining()) { return _buffer.get() & 0xFF; } return -1; } | ByteBufferInputStream extends InputStream { @Override public int read() throws IOException { if (_buffer.hasRemaining()) { return _buffer.get() & 0xFF; } return -1; } } | ByteBufferInputStream extends InputStream { @Override public int read() throws IOException { if (_buffer.hasRemaining()) { return _buffer.get() & 0xFF; } return -1; } ByteBufferInputStream(ByteBuffer buffer); } | ByteBufferInputStream extends InputStream { @Override public int read() throws IOException { if (_buffer.hasRemaining()) { return _buffer.get() & 0xFF; } return -1; } ByteBufferInputStream(ByteBuffer buffer); @Override int read(); @Override int read(byte[] b, int off, int len); @Override void mark(int readlimit); @Over... | ByteBufferInputStream extends InputStream { @Override public int read() throws IOException { if (_buffer.hasRemaining()) { return _buffer.get() & 0xFF; } return -1; } ByteBufferInputStream(ByteBuffer buffer); @Override int read(); @Override int read(byte[] b, int off, int len); @Override void mark(int readlimit); @Over... |
@Test public void testGetActiveFileName() { _policy.getActiveFileName(); verify(_delegate).getActiveFileName(); } | @Override public String getActiveFileName() { return _decorated.getActiveFileName(); } | RollingPolicyDecorator implements RollingPolicy { @Override public String getActiveFileName() { return _decorated.getActiveFileName(); } } | RollingPolicyDecorator implements RollingPolicy { @Override public String getActiveFileName() { return _decorated.getActiveFileName(); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorService executorService); } | RollingPolicyDecorator implements RollingPolicy { @Override public String getActiveFileName() { return _decorated.getActiveFileName(); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorService executorService); @Override void rollover(); @Override String getActiveFileName... | RollingPolicyDecorator implements RollingPolicy { @Override public String getActiveFileName() { return _decorated.getActiveFileName(); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorService executorService); @Override void rollover(); @Override String getActiveFileName... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.