亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Rest API post請求將Cucumber.json文件發送到Java中的Jira

Rest API post請求將Cucumber.json文件發送到Java中的Jira

人到中年有點甜 2023-07-13 14:01:19
有人可以告訴我從哪里開始嗎?父面板需要知道子面板之間的關系。一種方法是保持跟蹤ArrayList組件對之間的關系。然后,您需要重寫paintChildren(...)父面板的方法以在兩個子面板之間繪制一條線。您在父面板類中定義 ArrayList:private ArrayList<Component> relationships = new ArrayList<Component>();然后根據需要將組件對添加到 ArrayList:relationships.add( component1a );relationships.add( component1b );基本的繪畫代碼是:@Overrideprotected void paintChildren(Graphics g){    fr (int i = 0; i < relationships.size(); i += 2)    {        Component one = relationships.get(i);        Component two = relationships.get(i + 1);        Point p1 = //calculate the center of component one        Point p2 = //calculate the center of component two        g.drawline(p1.x, p1.y, p2.x, p2.y);    }    super.paintChildren(g);}因此,上面的代碼應該在添加到 ArrayList 的每對組件的中心點之間繪制線條。然后,子面板將繪制在線條的頂部,以便線條看起來像是從每個組件的邊緣出來的。查看trashgod 的GraphPanel示例。此示例支持拖動形狀,并且線條將跟隨形狀。我無法使用 REST API post 請求將存儲在 .json 文件中的 Cucumber 測試結果更新到 Jira。我可以使用相同的方法來更新 Cucumber 中的功能,但它不適用于我的 Json 結果文件。我對 Java 和 Json 還很陌生。因此在理解它們時遇到了一些問題。我嘗試將 Json 文件轉換為 Json 數組以及 Json 對象,但它不起作用。//下面是我的方法,它從項目中獲取文件路徑和 URL 來更新 Jira 中 Xray 的結果public static void importCucumberResultFilesToJira(String filePath, String resultTypeUrlValue) throws IOException {    String jiraUrl = config.getJiraLoginValue();    log.info(String.format("Starting upload of Cucumber features to XRAY on Jira project: %s\n Using Jira user: %s ", config.getJiraProjectValue(), config.getJiraLoginValue()));    log.info(String.format("Path to Report: %s", filePath));    String authentication = config.getJiraLoginValue() + ':' + config.getJiraPassword();    BASE64Encoder encoder = new BASE64Encoder();    String encoded = null;    try {        encoded = encoder.encode((authentication).getBytes("UTF-8"));    } catch (UnsupportedEncodingException e) {        e.printStackTrace();    }// 我在 POM.xml 中的依賴項我發布它是因為根據我在 SO 和其他網站上所做的研究,有時某些依賴項會帶來問題
查看完整描述

1 回答

?
MMTTMM

TA貢獻1869條經驗 獲得超4個贊

好吧,我自己找到了問題的答案。我所要做的就是將 .json 文件作為輸入流而不是 Json 數組傳遞給響應。我剛剛更換


JsonParser parser = new JsonParser();

Object obj = parser.parse(br);

JsonArray arr = (JsonArray) obj;  


InputStream input = new FileInputStream(filePath);


查看完整回答
反對 回復 2023-07-13
  • 1 回答
  • 0 關注
  • 132 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號