NlpApp implements Runnable, Monitorable, UserTask { @Override public double getProgressRate() { return forwarder.getProgressRate(); } @AssistedInject  NlpApp(final DataBus dataBus, final Indexer indexer, final PropertiesProvider propertiesProvider, @Assisted final Pipeline pipeline, @Assisted final User user); @AssistedInject  NlpApp(final DataBus dataBus, final Indexer indexer, @Assisted final Pipeline pipeline, @Assisted final Properties properties,
                  @Assisted final User user, @Assisted final Runnable subscribeCb);   NlpApp(final DataBus dataBus, final Indexer indexer, final Pipeline pipeline, final Properties properties,
           Runnable subscribedCb, long shutdownTimeoutMillis, boolean cleanShutdown, User user); void run(); @Override double getProgressRate(); @Override String toString(); @Override User getUser();  }
@Test(timeout = 5000) public void test_nlp_app_progress_rate() throws Exception { NlpApp nlpApp = runNlpApp("1", 0); assertThat(nlpApp.getProgressRate()).isEqualTo(-1); dataBus.publish(Channel.NLP, new Message(INIT_MONITORING).add(VALUE, "4")); dataBus.publish(Channel.NLP, new Message(EXTRACT_NLP).add(DOC_ID, "doc_id1").add(R_ID, "routing1").add(INDEX_NAME, local().id)); dataBus.publish(Channel.NLP, new Message(EXTRACT_NLP).add(DOC_ID, "doc_id2").add(R_ID, "routing2").add(INDEX_NAME, local().id)); dataBus.publish(Channel.NLP, new ShutdownMessage()); shutdownNlpApp(); assertThat(nlpApp.getProgressRate()).isEqualTo(0.5); }
@Test(timeout = 5000) public void test_nlp_app_progress_rate__two_init_add_values() throws Exception { NlpApp nlpApp = runNlpApp("1", 0); assertThat(nlpApp.getProgressRate()).isEqualTo(-1); dataBus.publish(Channel.NLP, new Message(INIT_MONITORING).add(VALUE, "4")); dataBus.publish(Channel.NLP, new Message(INIT_MONITORING).add(VALUE, "6")); dataBus.publish(Channel.NLP, new Message(EXTRACT_NLP).add(DOC_ID, "doc_id").add(R_ID, "routing").add(INDEX_NAME, local().id)); dataBus.publish(Channel.NLP, new ShutdownMessage()); shutdownNlpApp(); assertThat(nlpApp.getProgressRate()).isEqualTo(0.1); }