久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <legend id='ikLLM'><style id='ikLLM'><dir id='ikLLM'><q id='ikLLM'></q></dir></style></legend>

      <small id='ikLLM'></small><noframes id='ikLLM'>

    1. <i id='ikLLM'><tr id='ikLLM'><dt id='ikLLM'><q id='ikLLM'><span id='ikLLM'><b id='ikLLM'><form id='ikLLM'><ins id='ikLLM'></ins><ul id='ikLLM'></ul><sub id='ikLLM'></sub></form><legend id='ikLLM'></legend><bdo id='ikLLM'><pre id='ikLLM'><center id='ikLLM'></center></pre></bdo></b><th id='ikLLM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ikLLM'><tfoot id='ikLLM'></tfoot><dl id='ikLLM'><fieldset id='ikLLM'></fieldset></dl></div>

      1. <tfoot id='ikLLM'></tfoot>
          <bdo id='ikLLM'></bdo><ul id='ikLLM'></ul>
      2. 如何將 util java 類重用到其他空手道項目中?

        How to reuse util java class into other karate project?(如何將 util java 類重用到其他空手道項目中?)

              <tbody id='MYepK'></tbody>

              <bdo id='MYepK'></bdo><ul id='MYepK'></ul>
                <tfoot id='MYepK'></tfoot>

                <legend id='MYepK'><style id='MYepK'><dir id='MYepK'><q id='MYepK'></q></dir></style></legend>

                <small id='MYepK'></small><noframes id='MYepK'>

                  <i id='MYepK'><tr id='MYepK'><dt id='MYepK'><q id='MYepK'><span id='MYepK'><b id='MYepK'><form id='MYepK'><ins id='MYepK'></ins><ul id='MYepK'></ul><sub id='MYepK'></sub></form><legend id='MYepK'></legend><bdo id='MYepK'><pre id='MYepK'><center id='MYepK'></center></pre></bdo></b><th id='MYepK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='MYepK'><tfoot id='MYepK'></tfoot><dl id='MYepK'><fieldset id='MYepK'></fieldset></dl></div>
                  本文介紹了如何將 util java 類重用到其他空手道項目中?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在使用空手道框架來測試我的休息服務,它工作得很好,但是我有服務消耗來自 kafka 主題的消息然后堅持 mongo 最終通知 kafka.我在我的空手道項目中創建了一個 java 生產者,它由 js 調用以供功能使用.然后我有一個消費者來檢查消息

                  I was working with karate framework to test my rest service and it work great, however I have service that consume message from kafka topic then persist on mongo to finally notify kafka. I made a java producer on my karate project, it called by js to be used by feature. Then I have a consumer to check the message

                  特點:

                      * def kafkaProducer = read('../js/KafkaProducer.js')
                  

                  JS:

                  function(kafkaConfiguration){
                  var Producer = Java.type('x.y.core.producer.Producer');
                  var producer = new Producer(kafkaConfiguration);
                  return producer;
                  }
                  

                  Java:

                  public class Producer {
                  
                  private static final Logger LOGGER = LoggerFactory.getLogger(Producer.class);
                  
                  private static final String KEY = "C636E8E238FD7AF97E2E500F8C6F0F4C";
                  private KafkaConfiguration kafkaConfiguration;
                  private ObjectMapper mapper;
                  private AESEncrypter aesEncrypter;
                  
                  
                  public Producer(KafkaConfiguration kafkaConfiguration) {
                      kafkaConfiguration.getProperties().put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
                      kafkaConfiguration.getProperties().put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArraySerializer");
                      this.kafkaConfiguration = kafkaConfiguration;
                      this.mapper = new ObjectMapper();
                      this.aesEncrypter = new AESEncrypter(KEY);
                  }
                  
                  
                  public String produceMessage(String payload) {
                  
                    // Just notify kafka with payload and return id of payload
                  }
                  

                  其他類

                  public class KafkaConfiguration {
                  
                  private static final Logger LOGGER = LoggerFactory.getLogger(KafkaConfiguration.class);
                  
                  private Properties properties;
                  
                  public KafkaConfiguration(String host) {
                  
                      try {
                          properties = new Properties();
                          properties.put(BOOTSTRAP_SERVERS_CONFIG, host);
                          properties.put(ConsumerConfig.GROUP_ID_CONFIG, "karate-integration-test");
                          properties.put(ConsumerConfig.CLIENT_ID_CONFIG, "offset123");
                          properties.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, true);
                          properties.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
                      } catch (Exception e) {
                          LOGGER.error("Fail creating the consumer...", e);
                          throw e;
                      }
                  }
                  
                  public Properties getProperties() {
                      return properties;
                  }
                  
                  public void setProperties(Properties properties) {
                      this.properties = properties;
                  }
                  }
                  

                  我想使用帶有注釋的生產者代碼,就像黃瓜喜歡的那樣:

                  I'd would like to use the producer code with anotation like cucumber does like:

                  @Then("^Notify kafka with payload (-?\d+)$")
                      public void validateResult(String payload) throws Throwable {
                          new Producer(kafkaConfiguration).produceMessage(payload);
                      }
                  

                  關于功能使用

                  Then Notify kafka with payload "{example:value}"
                  

                  我想這樣做是因為我想在基礎項目中重用該代碼,以便包含在其他項目中如果注釋不起作用,也許您可??以建議我另一種方法

                  I want to do that because I want to reuse that code on base project in order to be included in other project If annotation doesn't works, maybe you can suggest me another way to do it

                  推薦答案

                  答案很簡單,使用普通的 Java/Maven 概念.將通用 Java 代碼移動到主"包 (src/main/java).現在您需要做的就是構建一個 JAR 并將其作為依賴項添加到任何空手道項目中.

                  The answer is simple, use normal Java / Maven concepts. Move the common Java code to the "main" packages (src/main/java). Now all you need to do is build a JAR and add it as a dependency to any Karate project.

                  最后一個難題是:使用 classpath: 前綴來引用 JAR 中的任何特性或 JS 文件.空手道可以接他們.

                  The last piece of the puzzle is this: use the classpath: prefix to refer to any features or JS files in the JAR. Karate will be able to pick them up.

                  抱歉空手道不支持 Cucumber 或步驟定義.它有一個更簡單的方法.詳情請閱讀:https://github.com/intuit/karate/issues/398

                  Sorry Karate does not support Cucumber or step-definitions. It has a much simpler approach. Please read this for details: https://github.com/intuit/karate/issues/398

                  這篇關于如何將 util java 類重用到其他空手道項目中?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)
                          <tbody id='0U7aL'></tbody>
                      • <small id='0U7aL'></small><noframes id='0U7aL'>

                        <i id='0U7aL'><tr id='0U7aL'><dt id='0U7aL'><q id='0U7aL'><span id='0U7aL'><b id='0U7aL'><form id='0U7aL'><ins id='0U7aL'></ins><ul id='0U7aL'></ul><sub id='0U7aL'></sub></form><legend id='0U7aL'></legend><bdo id='0U7aL'><pre id='0U7aL'><center id='0U7aL'></center></pre></bdo></b><th id='0U7aL'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0U7aL'><tfoot id='0U7aL'></tfoot><dl id='0U7aL'><fieldset id='0U7aL'></fieldset></dl></div>
                          <bdo id='0U7aL'></bdo><ul id='0U7aL'></ul>
                          <tfoot id='0U7aL'></tfoot>

                        • <legend id='0U7aL'><style id='0U7aL'><dir id='0U7aL'><q id='0U7aL'></q></dir></style></legend>
                          • 主站蜘蛛池模板: 男女免费视频网站 | 国产精久久久久久久 | 精品国产乱码久久久久久88av | 中文av字幕 | 99re视频| 久久精品视频在线观看 | 国产精品一区二区av | 综合九九 | 亚洲精品欧洲 | 成人久久久 | 日韩欧美专区 | 久久综合成人精品亚洲另类欧美 | 国产精品久久久爽爽爽麻豆色哟哟 | 男人的天堂久久 | 国产一在线观看 | 久干网 | 久久亚洲综合 | 在线观看av网站永久 | 特级黄色毛片 | 欧美一区二区三区一在线观看 | 亚洲精品国产a久久久久久 午夜影院网站 | 日本成人中文字幕 | 一二三四av | 亚洲高清视频在线观看 | 九热在线| 91中文视频| 精品区| 美女日批免费视频 | 亚洲综合在线网 | 国产欧美在线 | 久久精品国产亚洲 | 97久久精品午夜一区二区 | 日本又色又爽又黄又高潮 | 在线免费观看视频你懂的 | 国产精品九九九 | 国产情侣啪啪 | aa级毛片毛片免费观看久 | 一区二区三区精品 | 亚洲精品电影网在线观看 | 国产在线一区二区 | 99精品视频网 |