test_class.declarator: expectedTask
test_class.modifier: private final
test_class.original_string: private final T expectedTask;
test_class.type: T
test_class.var_name: expectedTask
test_class.declarator: time = new AtomicLong(77777)
test_class.modifier: private final
test_class.original_string: private final AtomicLong time = new AtomicLong(77777);
test_class.type: AtomicLong
test_class.var_name: time
test_class.file: proxy/src/test/java/com/wavefront/agent/queueing/InMemorySubmissionQueueTest.java
test_class.identifier: InMemorySubmissionQueueTest
test_case.body: @Test
    public void testTaskRead() {
      TaskQueue queue = new InMemorySubmissionQueue<>();
      UUID proxyId = UUID.randomUUID();
      DataSubmissionTask<? extends DataSubmissionTask<?>> task = null;
      if (this.expectedTask instanceof LineDelimitedDataSubmissionTask) {
        task = new LineDelimitedDataSubmissionTask(null, proxyId,
            new DefaultEntityPropertiesForTesting(), queue, "wavefront", ReportableEntityType.POINT,
            "2878", ImmutableList.of("item1", "item2", "item3"), time::get);
      } else if (this.expectedTask instanceof EventDataSubmissionTask) {
        task = new EventDataSubmissionTask(null, proxyId,
            new DefaultEntityPropertiesForTesting(), queue, "2878",
            ImmutableList.of(
                new Event(ReportEvent.newBuilder().
                    setStartTime(time.get() * 1000).
                    setEndTime(time.get() * 1000 + 1).
                    setName("Event name for testing").
                    setHosts(ImmutableList.of("host1", "host2")).
                    setDimensions(ImmutableMap.of("multi", ImmutableList.of("bar", "baz"))).
                    setAnnotations(ImmutableMap.of("severity", "INFO")).
                    setTags(ImmutableList.of("tag1")).
                    build())),
            time::get);
      } else if (this.expectedTask instanceof SourceTagSubmissionTask) {
        task = new SourceTagSubmissionTask(null,
            new DefaultEntityPropertiesForTesting(), queue, "2878",
            new SourceTag(
                ReportSourceTag.newBuilder().setOperation(SourceOperationType.SOURCE_TAG).
                    setAction(SourceTagAction.SAVE).setSource("testSource").
                    setAnnotations(ImmutableList.of("newtag1", "newtag2")).build()),
            time::get);
      }
      assertNotNull(task);
      task.enqueue(QueueingReason.RETRY);
  
      if (this.expectedTask instanceof LineDelimitedDataSubmissionTask) {
        LineDelimitedDataSubmissionTask readTask = (LineDelimitedDataSubmissionTask) queue.peek();
        assertNotNull(readTask);
        assertEquals(((LineDelimitedDataSubmissionTask) task).payload(), readTask.payload());
        assertEquals(((LineDelimitedDataSubmissionTask) this.expectedTask).payload(), readTask.payload());
        assertEquals(77777, readTask.getEnqueuedMillis());
      }
      if (this.expectedTask instanceof EventDataSubmissionTask) {
        EventDataSubmissionTask readTask = (EventDataSubmissionTask) queue.peek();
        assertNotNull(readTask);
        assertEquals(((EventDataSubmissionTask) task).payload(), readTask.payload());
        assertEquals(((EventDataSubmissionTask) this.expectedTask).payload(), readTask.payload());
        assertEquals(77777, readTask.getEnqueuedMillis());
      }
      if (this.expectedTask instanceof SourceTagSubmissionTask) {
        SourceTagSubmissionTask readTask = (SourceTagSubmissionTask) queue.peek();
        assertNotNull(readTask);
        assertEquals(((SourceTagSubmissionTask) task).payload(), readTask.payload());
        assertEquals(((SourceTagSubmissionTask) this.expectedTask).payload(), readTask.payload());
        assertEquals(77777, readTask.getEnqueuedMillis());
      }
    }
test_case.class_method_signature: InMemorySubmissionQueueTest.testTaskRead()
test_case.full_signature: @Test public void testTaskRead()
test_case.identifier: testTaskRead
test_case.invocations: randomUUID of of build setTags setAnnotations setDimensions setHosts setName setEndTime setStartTime newBuilder get get of of of of of build setAnnotations setSource setAction setOperation newBuilder of assertNotNull enqueue peek assertNotNull assertEquals payload payload assertEquals payload payload assertEquals getEnqueuedMillis peek assertNotNull assertEquals payload payload assertEquals payload payload assertEquals getEnqueuedMillis peek assertNotNull assertEquals payload payload assertEquals payload payload assertEquals getEnqueuedMillis
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testTaskRead()
focal_class.declarator: log =
        Logger.getLogger(InMemorySubmissionQueue.class.getCanonicalName())
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log =
        Logger.getLogger(InMemorySubmissionQueue.class.getCanonicalName());
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: MAX_BUFFER_SIZE = 50_000
focal_class.modifier: private static final
focal_class.original_string: private static final int MAX_BUFFER_SIZE = 50_000;
focal_class.type: int
focal_class.var_name: MAX_BUFFER_SIZE
focal_class.declarator: wrapped
focal_class.modifier: private final
focal_class.original_string: private final ObjectQueue<T> wrapped;
focal_class.type: ObjectQueue<T>
focal_class.var_name: wrapped
focal_class.declarator: currentWeight = new AtomicLong()
focal_class.modifier: private final
focal_class.original_string: private final AtomicLong currentWeight = new AtomicLong();
focal_class.type: AtomicLong
focal_class.var_name: currentWeight
focal_class.declarator: head
focal_class.modifier: private
focal_class.original_string: private T head;
focal_class.type: T
focal_class.var_name: head
focal_class.file: proxy/src/main/java/com/wavefront/agent/queueing/InMemorySubmissionQueue.java
focal_class.identifier: InMemorySubmissionQueue
focal_class.interfaces: implements TaskQueue<T>
focal_class.class_method_signature: InMemorySubmissionQueue.InMemorySubmissionQueue()
focal_class.full_signature: public  InMemorySubmissionQueue()
focal_class.identifier: InMemorySubmissionQueue
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  InMemorySubmissionQueue()
focal_class.class_method_signature: InMemorySubmissionQueue.size()
focal_class.full_signature: @Override public int size()
focal_class.identifier: size
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int size()
focal_class.class_method_signature: InMemorySubmissionQueue.weight()
focal_class.full_signature: @Nullable @Override public Long weight()
focal_class.identifier: weight
focal_class.modifiers: @Nullable @Override public
focal_class.parameters: ()
focal_class.return: Long
focal_class.signature: Long weight()
focal_class.class_method_signature: InMemorySubmissionQueue.getAvailableBytes()
focal_class.full_signature: @Nullable @Override public Long getAvailableBytes()
focal_class.identifier: getAvailableBytes
focal_class.modifiers: @Nullable @Override public
focal_class.parameters: ()
focal_class.return: Long
focal_class.signature: Long getAvailableBytes()
focal_class.class_method_signature: InMemorySubmissionQueue.getName()
focal_class.full_signature: @Override public String getName()
focal_class.identifier: getName
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getName()
focal_class.class_method_signature: InMemorySubmissionQueue.peek()
focal_class.full_signature: @Nullable @Override public T peek()
focal_class.identifier: peek
focal_class.modifiers: @Nullable @Override public
focal_class.parameters: ()
focal_class.return: T
focal_class.signature: T peek()
focal_class.class_method_signature: InMemorySubmissionQueue.add(@Nonnull T entry)
focal_class.full_signature: @Override public void add(@Nonnull T entry)
focal_class.identifier: add
focal_class.modifiers: @Override public
focal_class.parameters: (@Nonnull T entry)
focal_class.return: void
focal_class.signature: void add(@Nonnull T entry)
focal_class.class_method_signature: InMemorySubmissionQueue.clear()
focal_class.full_signature: @Override public void clear()
focal_class.identifier: clear
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void clear()
focal_class.class_method_signature: InMemorySubmissionQueue.remove()
focal_class.full_signature: @Override public void remove()
focal_class.identifier: remove
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void remove()
focal_class.class_method_signature: InMemorySubmissionQueue.close()
focal_class.full_signature: @Override public void close()
focal_class.identifier: close
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_class.class_method_signature: InMemorySubmissionQueue.iterator()
focal_class.full_signature: @NotNull @Override public Iterator<T> iterator()
focal_class.identifier: iterator
focal_class.modifiers: @NotNull @Override public
focal_class.parameters: ()
focal_class.return: Iterator<T>
focal_class.signature: Iterator<T> iterator()
focal_method.body: @Nullable
    @Override
    public T peek() {
      try {
        if (this.head != null) return this.head;
        this.head = wrapped.peek();
        return this.head;
      } catch (IOException ex) {
        throw Utils.<Error>throwAny(ex);
      }
    }
focal_method.class_method_signature: InMemorySubmissionQueue.peek()
focal_method.full_signature: @Nullable @Override public T peek()
focal_method.identifier: peek
focal_method.invocations: peek throwAny
focal_method.modifiers: @Nullable @Override public
focal_method.parameters: ()
focal_method.return: T
focal_method.signature: T peek()