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

        <bdo id='uu2WV'></bdo><ul id='uu2WV'></ul>

      1. <small id='uu2WV'></small><noframes id='uu2WV'>

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

        在 docker 容器中運行 maven 集成測試

        Running maven integration test inside docker container(在 docker 容器中運行 maven 集成測試)
        1. <small id='CXtPn'></small><noframes id='CXtPn'>

              <bdo id='CXtPn'></bdo><ul id='CXtPn'></ul>

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

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

                    <tbody id='CXtPn'></tbody>
                  本文介紹了在 docker 容器中運行 maven 集成測試的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  在運行集成測試之前,我正在使用 dockerfile-maven 插件將我的 jar 文件移動到 docker 容器中.但是 mvn verify 命令構建圖像并運行集成測試,結果測試失敗.有人可以在運行集成測試之前幫我運行 docker 映像嗎?這樣我就可以從我的集成測試文件 ping 到在 docker 容器內運行的服務.

                  以下是我的集成測試文件.

                  import java.sql.Connection;導入 java.sql.DriverManager;導入 java.sql.Statement;導入java.sql.SQLException;導入java.sql.ResultSet;導入 java.io.IOException;導入java.io.File;導入 java.util.Scanner;導入靜態 org.hamcrest.MatcherAssert.*;導入靜態 org.junit.matchers.JUnitMatchers.*;導入 org.junit.Assert.*;導入 com.facebook.presto.jdbc.PrestoDriver;導入 io.airlift.log.Logger;導入 org.testng.annotations.Test;類IntegrationTestIT {@測試公共無效 checkForQueryInFile() {System.out.println("這個測試方法應該運行");字符串 url = "jdbc:presto://localhost:8889/jmx/default";語句 stmt = null;嘗試 {連接連接 = DriverManager.getConnection(url, "jumbo", null);stmt = connection.createStatement();字符串文件路徑 = "";String sql_string = "顯示模式";結果集 rs = stmt.executeQuery(sql_string);文件夾 = new File("http://jars");//將此移動到常量類文件[] 文件 = 文件夾.listFiles();對于(文件文件:文件){if (file.isFile()) {file_path = file.getAbsolutePath();}}文件 log_file = new File(file_path);最終字符串掃描儀=新掃描儀(log_file).useDelimiter(\Z").next();;assertThat(掃描儀,包含字符串(sql_string));rs.close();stmt.close();連接.close();} 捕捉(IOException 異常){異常.printStackTrace();} 捕捉(SQLException sqlException){sqlException.printStackTrace();}}}

                  測試報告:

                  [INFO] 成功構建 rohitbarnwal7/presto_log_updated:0.0.1[信息] maven-failsafe-plugin:2.5:integration-test (默認) @plugin[INFO] 故障安全報告目錄:/Users/rohit/workspace/presto plugins/target/failsafe-reports-------------------------------------------------------T E S T S-------------------------------------------------------運行測試套件測試運行:1,失敗:1,錯誤:0,跳過:0,經過的時間:0.833 秒 <<<<失敗!結果 :失敗的測試:checkForQueryInFile(IntegrationTestIT)測試運行:1,失敗:1,錯誤:0,跳過:0

                  TestSuite.txt 中的集成測試結果

                  測試運行:1,失敗:1,錯誤:0,跳過:0,經過時間:0.559 秒 <<<<失敗!checkForQueryInFile(IntegrationTestIT) 經過時間:0.015 秒 <<<<失敗!java.lang.IllegalAccessException:類 org.testng.internal.MethodInvocationHelper 無法訪問帶有修飾符public"的類 IntegrationTestIT 的成員在 sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)在 java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:296)在 java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:288)在 java.lang.reflect.Method.invoke(Method.java:491)在 org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)在 org.testng.internal.Invoker.invokeMethod(Invoker.java:639)在 org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)在 org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)在 org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)在 org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)在 org.testng.TestRunner.privateRun(TestRunner.java:774)在 org.testng.TestRunner.run(TestRunner.java:624)在 org.testng.SuiteRunner.runTest(SuiteRunner.java:359)在 org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)在 org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)在 org.testng.SuiteRunner.run(SuiteRunner.java:261)在 org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)在 org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)在 org.testng.TestNG.runSuitesSequentially(TestNG.java:1191)在 org.testng.TestNG.runSuitesLocally(TestNG.java:1116)在 org.testng.TestNG.run(TestNG.java:1024)在 org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62)在 org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141)在 org.apache.maven.surefire.Surefire.run(Surefire.java:180)在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)在 java.lang.reflect.Method.invoke(Method.java:498)在 org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)在 org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)

                  解決方案

                  輔助功能錯誤信息:

                  <塊引用>

                  java.lang.IllegalAccessException:類 org.testng.internal.MethodInvocationHelper 無法訪問帶有修飾符public"的 IntegrationTestIT 類的成員

                  你必須公開你的班級才能運行測試:

                  公共類 IntegrationTestIT {...

                  測序問題:

                  如果您的集成測試在 integration-test 階段運行,您可以在 pre-integration-test 階段強制執行 docker 插件:

                  <執行>...<階段>預集成測試</階段></執行>

                  I am using dockerfile-maven plugin to move my jar file inside docker container before running integration testing. But mvn verify command builds the images and run integration test, as a result test fails. Can someone help me run the docker images before running integration test. So that I can ping to service running inside docker container from my integration test file.

                  Below is my integration test file.

                  import java.sql.Connection;
                  import java.sql.DriverManager;
                  import java.sql.Statement;
                  import java.sql.SQLException;
                  import java.sql.ResultSet;
                  import java.io.IOException;
                  import java.io.File;
                  import java.util.Scanner;
                  import static org.hamcrest.MatcherAssert.*;
                  import static org.junit.matchers.JUnitMatchers.*;
                  import org.junit.Assert.*;
                  import com.facebook.presto.jdbc.PrestoDriver;
                  import io.airlift.log.Logger;
                  import org.testng.annotations.Test;
                  
                  class IntegrationTestIT {
                  
                  @Test
                  public void checkForQueryInFile() {
                  
                      System.out.println("This test method should be run");
                      String url = "jdbc:presto://localhost:8889/jmx/default";
                  
                      Statement stmt = null;
                      try {
                          Connection connection = DriverManager.getConnection(url, "jumbo", null);
                  
                          stmt = connection.createStatement();
                          String file_path = "";
                          String sql_string = "show schemas";
                  
                          ResultSet rs = stmt.executeQuery(sql_string);
                          File folder = new File("http://jars");
                          // Move this to constant class
                          File[] files = folder.listFiles(); 
                  
                          for (File file:files) {
                              if (file.isFile()) {
                                  file_path = file.getAbsolutePath();
                              }
                          }
                          File log_file = new File(file_path);
                          final String scanner = new Scanner(log_file).useDelimiter("\Z").next();;
                  
                          assertThat(scanner, containsString(sql_string));
                  
                      rs.close();
                      stmt.close();
                      connection.close();
                  
                      } catch (IOException exception) {
                          exception.printStackTrace();
                      } catch(SQLException sqlException) {
                          sqlException.printStackTrace();
                      }
                  }
                  }
                  

                  Test Report:

                  [INFO] Successfully built rohitbarnwal7/presto_log_updated:0.0.1
                  [INFO] maven-failsafe-plugin:2.5:integration-test (default) @plugin
                  [INFO] Failsafe report directory: /Users/rohit/workspace/presto plugins/target/failsafe-reports
                  
                  -------------------------------------------------------
                   T E S T S
                  -------------------------------------------------------
                  Running TestSuite
                  Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.833 sec <<< FAILURE!
                  
                  Results :
                  
                  Failed tests:
                    checkForQueryInFile(IntegrationTestIT)
                  
                  Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
                  

                  Integration Test result from TestSuite.txt

                  Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.559 sec <<< FAILURE!
                  checkForQueryInFile(IntegrationTestIT)  Time elapsed: 0.015 sec  <<< FAILURE!
                  java.lang.IllegalAccessException: Class org.testng.internal.MethodInvocationHelper can not access a member of class IntegrationTestIT with modifiers "public"
                      at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)
                      at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:296)
                      at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:288)
                      at java.lang.reflect.Method.invoke(Method.java:491)
                      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
                      at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
                      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
                      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
                      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
                      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
                      at org.testng.TestRunner.privateRun(TestRunner.java:774)
                      at org.testng.TestRunner.run(TestRunner.java:624)
                      at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
                      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
                      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
                      at org.testng.SuiteRunner.run(SuiteRunner.java:261)
                      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
                      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
                      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1191)
                      at org.testng.TestNG.runSuitesLocally(TestNG.java:1116)
                      at org.testng.TestNG.run(TestNG.java:1024)
                      at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62)
                      at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141)
                      at org.apache.maven.surefire.Surefire.run(Surefire.java:180)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                      at java.lang.reflect.Method.invoke(Method.java:498)
                      at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
                      at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
                  

                  解決方案

                  Accessibility error message :

                  java.lang.IllegalAccessException: Class org.testng.internal.MethodInvocationHelper can not access a member of class IntegrationTestIT with modifiers "public"

                  You have to make your class public to run tests :

                  public class IntegrationTestIT {
                  ...
                  

                  Sequencing issue :

                  If your integration tests are running in the integration-test phase, you can force the execution of the docker plugin during the pre-integration-test phase :

                  <execution>
                      ...
                      <phase>pre-integration-test</phase>
                  </execution>
                  

                  這篇關于在 docker 容器中運行 maven 集成測試的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='DA2pJ'></tbody>
                    <bdo id='DA2pJ'></bdo><ul id='DA2pJ'></ul>
                    <tfoot id='DA2pJ'></tfoot>

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

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

                          <i id='DA2pJ'><tr id='DA2pJ'><dt id='DA2pJ'><q id='DA2pJ'><span id='DA2pJ'><b id='DA2pJ'><form id='DA2pJ'><ins id='DA2pJ'></ins><ul id='DA2pJ'></ul><sub id='DA2pJ'></sub></form><legend id='DA2pJ'></legend><bdo id='DA2pJ'><pre id='DA2pJ'><center id='DA2pJ'></center></pre></bdo></b><th id='DA2pJ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='DA2pJ'><tfoot id='DA2pJ'></tfoot><dl id='DA2pJ'><fieldset id='DA2pJ'></fieldset></dl></div>
                          • 主站蜘蛛池模板: 免费亚洲视频 | 久久久影院 | 亚洲欧洲精品一区 | h视频在线播放 | 国产美女永久免费无遮挡 | 久久高清| 婷婷色网 | 国产精品99视频 | 欧洲毛片 | 国产精品99久久久久久动医院 | 欧美视频一区 | 欧美激情99 | 99色综合| 亚洲人成人一区二区在线观看 | 日韩成人精品一区 | 亚洲综合激情 | 亚洲成人自拍 | 国产精品我不卡 | av色在线 | 亚洲欧美激情精品一区二区 | 亚洲成人中文字幕 | 人成在线视频 | 91传媒在线观看 | 精品久久一| 国产精品久久久久久福利一牛影视 | 日韩免费毛片视频 | 青青久在线视频 | 亚洲午夜三级 | 久久久激情视频 | 在线黄| 中日字幕大片在线播放 | 日韩一区在线播放 | 国产一区二区影院 | 人人性人人性碰国产 | 亚洲一区不卡 | 日本国产高清 | 亚洲aⅴ| 黄a大片| 精品久久一区 | 精品国产31久久久久久 | 免费在线看黄 |