test_class.file: proxy/src/test/java/com/wavefront/agent/queueing/QueueExporterTest.java
test_class.identifier: QueueExporterTest
test_case.body: @Test
    public void testQueueExporterWithRetainData() throws Exception {
      File file = new File(File.createTempFile("proxyTestConverter", null).getPath() + ".queue");
      file.deleteOnExit();
      ProxyConfig config = new ProxyConfig();
      config.parseArguments(new String[]{
          "--flushThreads", "2",
          "--buffer", file.getAbsolutePath(),
          "--exportQueuePorts", "2878",
          "--exportQueueOutputFile", file.getAbsolutePath() + "-output",
          "--exportQueueRetainData", "true"
      }, "proxy");
      TaskQueueFactory taskQueueFactory = new TaskQueueFactoryImpl(config.getBufferFile(), false);
      EntityPropertiesFactory entityPropertiesFactory = new EntityPropertiesFactoryImpl(config);
      QueueExporter qe = new QueueExporter(config, taskQueueFactory, entityPropertiesFactory);
      BufferedWriter mockedWriter = EasyMock.createMock(BufferedWriter.class);
      reset(mockedWriter);
      HandlerKey key = HandlerKey.of(ReportableEntityType.POINT, "2878");
      TaskQueue<LineDelimitedDataSubmissionTask> queue = taskQueueFactory.getTaskQueue(key, 0);
      queue.clear();
      UUID proxyId = UUID.randomUUID();
      LineDelimitedDataSubmissionTask task = new LineDelimitedDataSubmissionTask(null, proxyId,
          new DefaultEntityPropertiesForTesting(), queue, "wavefront", ReportableEntityType.POINT,
          "2878", ImmutableList.of("item1", "item2", "item3"), () -> 12345L);
      task.enqueue(QueueingReason.RETRY);
      LineDelimitedDataSubmissionTask task2 = new LineDelimitedDataSubmissionTask(null, proxyId,
          new DefaultEntityPropertiesForTesting(), queue, "wavefront", ReportableEntityType.POINT,
          "2878", ImmutableList.of("item4", "item5"), () -> 12345L);
      task2.enqueue(QueueingReason.RETRY);
      queue.close();
  
      qe.export();
      File outputTextFile = new File(file.getAbsolutePath() + "-output.points.2878.0.txt");
      assertEquals(ImmutableList.of("item1", "item2", "item3", "item4", "item5"),
          Files.asCharSource(outputTextFile, Charsets.UTF_8).readLines());
      assertEquals(2, taskQueueFactory.getTaskQueue(key, 0).size());
    }
test_case.class_method_signature: QueueExporterTest.testQueueExporterWithRetainData()
test_case.full_signature: @Test public void testQueueExporterWithRetainData()
test_case.identifier: testQueueExporterWithRetainData
test_case.invocations: getPath createTempFile deleteOnExit parseArguments getAbsolutePath getAbsolutePath getBufferFile createMock reset of getTaskQueue clear randomUUID of enqueue of enqueue close export getAbsolutePath assertEquals of readLines asCharSource assertEquals size getTaskQueue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testQueueExporterWithRetainData()
focal_class.declarator: logger = Logger.getLogger(QueueExporter.class.getCanonicalName())
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = Logger.getLogger(QueueExporter.class.getCanonicalName());
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: FILENAME =
        Pattern.compile("^(.*)\\.(\\w+)\\.(\\w+)\\.(\\w+)\\.(\\w+)$")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern FILENAME =
        Pattern.compile("^(.*)\\.(\\w+)\\.(\\w+)\\.(\\w+)\\.(\\w+)$");
focal_class.type: Pattern
focal_class.var_name: FILENAME
focal_class.declarator: config
focal_class.modifier: private final
focal_class.original_string: private final ProxyConfig config;
focal_class.type: ProxyConfig
focal_class.var_name: config
focal_class.declarator: taskQueueFactory
focal_class.modifier: private final
focal_class.original_string: private final TaskQueueFactory taskQueueFactory;
focal_class.type: TaskQueueFactory
focal_class.var_name: taskQueueFactory
focal_class.declarator: entityPropertiesFactory
focal_class.modifier: private final
focal_class.original_string: private final EntityPropertiesFactory entityPropertiesFactory;
focal_class.type: EntityPropertiesFactory
focal_class.var_name: entityPropertiesFactory
focal_class.file: proxy/src/main/java/com/wavefront/agent/queueing/QueueExporter.java
focal_class.identifier: QueueExporter
focal_class.class_method_signature: QueueExporter.QueueExporter(ProxyConfig config, TaskQueueFactory taskQueueFactory,
                         EntityPropertiesFactory entityPropertiesFactory)
focal_class.full_signature: public  QueueExporter(ProxyConfig config, TaskQueueFactory taskQueueFactory,
                         EntityPropertiesFactory entityPropertiesFactory)
focal_class.identifier: QueueExporter
focal_class.modifiers: public
focal_class.parameters: (ProxyConfig config, TaskQueueFactory taskQueueFactory,
                         EntityPropertiesFactory entityPropertiesFactory)
focal_class.signature:  QueueExporter(ProxyConfig config, TaskQueueFactory taskQueueFactory,
                         EntityPropertiesFactory entityPropertiesFactory)
focal_class.class_method_signature: QueueExporter.export()
focal_class.full_signature: public void export()
focal_class.identifier: export
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void export()
focal_class.class_method_signature: QueueExporter.processHandlerKey(HandlerKey key)
focal_class.full_signature: @VisibleForTesting void processHandlerKey(HandlerKey key)
focal_class.identifier: processHandlerKey
focal_class.modifiers: @VisibleForTesting
focal_class.parameters: (HandlerKey key)
focal_class.return: void
focal_class.signature: void processHandlerKey(HandlerKey key)
focal_class.class_method_signature: QueueExporter.processQueue(TaskQueue<T> queue,
                                                        BufferedWriter writer)
focal_class.full_signature: @VisibleForTesting void processQueue(TaskQueue<T> queue,
                                                        BufferedWriter writer)
focal_class.identifier: processQueue
focal_class.modifiers: @VisibleForTesting
focal_class.parameters: (TaskQueue<T> queue,
                                                        BufferedWriter writer)
focal_class.return: void
focal_class.signature: void processQueue(TaskQueue<T> queue,
                                                        BufferedWriter writer)
focal_class.class_method_signature: QueueExporter.processTask(T task, BufferedWriter writer)
focal_class.full_signature: @VisibleForTesting void processTask(T task, BufferedWriter writer)
focal_class.identifier: processTask
focal_class.modifiers: @VisibleForTesting
focal_class.parameters: (T task, BufferedWriter writer)
focal_class.return: void
focal_class.signature: void processTask(T task, BufferedWriter writer)
focal_class.class_method_signature: QueueExporter.getValidHandlerKeys(List<String> files, String portList)
focal_class.full_signature: @VisibleForTesting static Set<HandlerKey> getValidHandlerKeys(List<String> files, String portList)
focal_class.identifier: getValidHandlerKeys
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (List<String> files, String portList)
focal_class.return: Set<HandlerKey>
focal_class.signature: Set<HandlerKey> getValidHandlerKeys(List<String> files, String portList)
focal_class.class_method_signature: QueueExporter.listFiles(String buffer)
focal_class.full_signature: @VisibleForTesting static List<String> listFiles(String buffer)
focal_class.identifier: listFiles
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (String buffer)
focal_class.return: List<String>
focal_class.signature: List<String> listFiles(String buffer)
focal_method.body: public void export() {
      Set<HandlerKey> handlerKeys = getValidHandlerKeys(listFiles(config.getBufferFile()),
          config.getExportQueuePorts());
      handlerKeys.forEach(this::processHandlerKey);
    }
focal_method.class_method_signature: QueueExporter.export()
focal_method.full_signature: public void export()
focal_method.identifier: export
focal_method.invocations: getValidHandlerKeys listFiles getBufferFile getExportQueuePorts forEach
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void export()