org.apache.commons.collections.Buffer Java Examples

The following examples show how to use org.apache.commons.collections.Buffer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NotifyServlet.java    From juddi with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public void doGet(HttpServletRequest request,
		HttpServletResponse response) throws
	ServletException, IOException {
	StringBuffer sb = new StringBuffer();

	Buffer nl = NotificationList.getInstance().getNotifications();
	Iterator<String> it = nl.iterator();
	while (it.hasNext()) {
		String notification = (String) it.next();		
		sb.append(notification);
	}
	nl.clear();
	PrintWriter out = response.getWriter();
	out.println(sb.toString());
}
 
Example #2
Source File: NotifyServlet.java    From juddi with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public void doGet(HttpServletRequest request,
		HttpServletResponse response) throws
	ServletException, IOException {
	StringBuffer sb = new StringBuffer();

	Buffer nl = NotificationList.getInstance().getNotifications();
	Iterator<String> it = nl.iterator();
	while (it.hasNext()) {
		String notification = (String) it.next();		
		sb.append(notification);
	}
	nl.clear();
	PrintWriter out = response.getWriter();
	out.println(sb.toString());
}
 
Example #3
Source File: ApiController.java    From AuTe-Framework with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "MQ request list getting", notes = "Get request history", tags = "MqMock")
@ApiResponses(
        value = {
                @ApiResponse(code = 200, message = "OK", responseContainer = "List"),
                @ApiResponse(code = 500, message = "Internal Server Error")
        }
)
@GetMapping("request-list")
@ResponseBody
public Collection getRequestList(@RequestParam(required = false, defaultValue = "${mq.requestBufferSize:1000}") Integer limit) {
    Buffer fifo = mqRunnerComponent.getFifo();
    List result = fifo != null ? new LinkedList(fifo) : new LinkedList();
    if (limit != null && result.size() > limit) {
        result = result.subList(result.size() - limit, result.size());
    }
    return result;
}
 
Example #4
Source File: ApiControllerTest.java    From AuTe-Framework with Apache License 2.0 5 votes vote down vote up
public ApiControllerTest() throws NoSuchFieldException, IllegalAccessException {
    MqRunnerComponent mqRunnerComponent = new MqRunnerComponent(new MqProperties(), new DummyJmsMappingsRepository());
    Field fifo = MqRunnerComponent.class.getDeclaredField("fifo");
    fifo.setAccessible(true);
    fifo.set(mqRunnerComponent, BufferUtils.synchronizedBuffer(new CircularFifoBuffer(BUFF_SIZE)));

    for (int i = 0; i < BUFF_SIZE; i++) {
        MockedRequest mockedRequest = new MockedRequest();
        mockedRequest.setDate(Date.from(LocalDateTime.of(2000 + i, 1, 1, 6, 30).atZone(ZoneId.systemDefault()).toInstant()));
        Buffer b = mqRunnerComponent.getFifo();
        b.add(mockedRequest);
    }

    apiController = new ApiController(mqRunnerComponent);
}
 
Example #5
Source File: NotificationList.java    From juddi with Apache License 2.0 4 votes vote down vote up
public Buffer getNotifications() {
	return list;
}
 
Example #6
Source File: ActiveMQWorker.java    From AuTe-Framework with Apache License 2.0 4 votes vote down vote up
public ActiveMQWorker(String sourceQueueName, MqProperties properties, List<MockMessage> mappings, Buffer fifo, String testIdHeaderName) {
    super(sourceQueueName, properties, mappings, fifo, testIdHeaderName);
}
 
Example #7
Source File: IbmMQWorker.java    From AuTe-Framework with Apache License 2.0 4 votes vote down vote up
public IbmMQWorker(String sourceQueueName, MqProperties properties, List<MockMessage> mappings, Buffer fifo, String testIdHeaderName) {
    super(sourceQueueName, properties, mappings, fifo, testIdHeaderName);
    extractor = new JmsMessageHeadersExtractor();
    transformer = new VelocityTransformer();
}
 
Example #8
Source File: RabbitMQWorker.java    From AuTe-Framework with Apache License 2.0 4 votes vote down vote up
public RabbitMQWorker(String sourceQueueName, MqProperties properties, List<MockMessage> mappings, Buffer fifo, String testIdHeaderName) {
    super(sourceQueueName, properties, mappings, fifo, testIdHeaderName);
}
 
Example #9
Source File: UnmodifiableBuffer.java    From Penetration_Testing_POC with Apache License 2.0 3 votes vote down vote up
/**
 * Factory method to create an unmodifiable buffer.
 * <p>
 * If the buffer passed in is already unmodifiable, it is returned.
 * 
 * @param buffer  the buffer to decorate, must not be null
 * @return an unmodifiable Buffer
 * @throws IllegalArgumentException if buffer is null
 */
public static Buffer decorate(Buffer buffer) {
    if (buffer instanceof Unmodifiable) {
        return buffer;
    }
    return new UnmodifiableBuffer(buffer);
}
 
Example #10
Source File: TransformedBuffer.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor that wraps (not copies).
 * <p>
 * If there are any elements already in the buffer being decorated, they
 * are NOT transformed.
 * 
 * @param buffer  the buffer to decorate, must not be null
 * @param transformer  the transformer to use for conversion, must not be null
 * @throws IllegalArgumentException if buffer or transformer is null
 */
protected TransformedBuffer(Buffer buffer, Transformer transformer) {
    super(buffer, transformer);
}
 
Example #11
Source File: UnmodifiableBuffer.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor that wraps (not copies).
 * 
 * @param buffer  the buffer to decorate, must not be null
 * @throws IllegalArgumentException if buffer is null
 */
private UnmodifiableBuffer(Buffer buffer) {
    super(buffer);
}
 
Example #12
Source File: TypedBuffer.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Factory method to create a typed list.
 * <p>
 * If there are any elements already in the buffer being decorated, they
 * are validated.
 * 
 * @param buffer  the buffer to decorate, must not be null
 * @param type  the type to allow into the buffer, must not be null
 * @return a new typed Buffer
 * @throws IllegalArgumentException if buffer or type is null
 * @throws IllegalArgumentException if the buffer contains invalid elements
 */
public static Buffer decorate(Buffer buffer, Class type) {
    return new PredicatedBuffer(buffer, InstanceofPredicate.getInstance(type));
}
 
Example #13
Source File: TransformedBuffer.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the decorated buffer.
 * 
 * @return the decorated buffer
 */
protected Buffer getBuffer() {
    return (Buffer) collection;
}
 
Example #14
Source File: BlockingBuffer.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Factory method to create a blocking buffer.
 * 
 * @param buffer  the buffer to decorate, must not be null
 * @return a new blocking Buffer
 * @throws IllegalArgumentException if buffer is null
 */
public static Buffer decorate(Buffer buffer) {
    return new BlockingBuffer(buffer);
}
 
Example #15
Source File: TransformedBuffer.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Factory method to create a transforming buffer.
 * <p>
 * If there are any elements already in the buffer being decorated, they
 * are NOT transformed.
 * 
 * @param buffer  the buffer to decorate, must not be null
 * @param transformer  the transformer to use for conversion, must not be null
 * @return a new transformed Buffer
 * @throws IllegalArgumentException if buffer or transformer is null
 */
public static Buffer decorate(Buffer buffer, Transformer transformer) {
    return new TransformedBuffer(buffer, transformer);
}
 
Example #16
Source File: AbstractBufferDecorator.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the buffer being decorated.
 * 
 * @return the decorated buffer
 */
protected Buffer getBuffer() {
    return (Buffer) getCollection();
}
 
Example #17
Source File: AbstractBufferDecorator.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor that wraps (not copies).
 * 
 * @param buffer  the buffer to decorate, must not be null
 * @throws IllegalArgumentException if list is null
 */
protected AbstractBufferDecorator(Buffer buffer) {
    super(buffer);
}
 
Example #18
Source File: SynchronizedBuffer.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the buffer being decorated.
 * 
 * @return the decorated buffer
 */
protected Buffer getBuffer() {
    return (Buffer) collection;
}
 
Example #19
Source File: SynchronizedBuffer.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor that wraps (not copies).
 * 
 * @param buffer  the buffer to decorate, must not be null
 * @param lock  the lock object to use, must not be null
 * @throws IllegalArgumentException if the buffer is null
 */
protected SynchronizedBuffer(Buffer buffer, Object lock) {
    super(buffer, lock);
}
 
Example #20
Source File: SynchronizedBuffer.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor that wraps (not copies).
 * 
 * @param buffer  the buffer to decorate, must not be null
 * @throws IllegalArgumentException if the buffer is null
 */
protected SynchronizedBuffer(Buffer buffer) {
    super(buffer);
}
 
Example #21
Source File: SynchronizedBuffer.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Factory method to create a synchronized buffer.
 * 
 * @param buffer  the buffer to decorate, must not be null
 * @return a new synchronized Buffer
 * @throws IllegalArgumentException if buffer is null
 */
public static Buffer decorate(Buffer buffer) {
    return new SynchronizedBuffer(buffer);
}
 
Example #22
Source File: PredicatedBuffer.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the buffer being decorated.
 * 
 * @return the decorated buffer
 */
protected Buffer getBuffer() {
    return (Buffer) getCollection();
}
 
Example #23
Source File: PredicatedBuffer.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor that wraps (not copies).
 * <p>
 * If there are any elements already in the collection being decorated, they
 * are validated.
 * 
 * @param buffer  the buffer to decorate, must not be null
 * @param predicate  the predicate to use for validation, must not be null
 * @throws IllegalArgumentException if buffer or predicate is null
 * @throws IllegalArgumentException if the buffer contains invalid elements
 */
protected PredicatedBuffer(Buffer buffer, Predicate predicate) {
    super(buffer, predicate);
}
 
Example #24
Source File: PredicatedBuffer.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Factory method to create a predicated (validating) buffer.
 * <p>
 * If there are any elements already in the buffer being decorated, they
 * are validated.
 * 
 * @param buffer  the buffer to decorate, must not be null
 * @param predicate  the predicate to use for validation, must not be null
 * @return a new predicated Buffer
 * @throws IllegalArgumentException if buffer or predicate is null
 * @throws IllegalArgumentException if the buffer contains invalid elements
 */
public static Buffer decorate(Buffer buffer, Predicate predicate) {
    return new PredicatedBuffer(buffer, predicate);
}
 
Example #25
Source File: BlockingBuffer.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor that wraps (not copies).
 * 
 * @param buffer  the buffer to decorate, must not be null
 * @throws IllegalArgumentException if the buffer is null
 */
protected BlockingBuffer(Buffer buffer) {
    super(buffer);
}