- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在寻找一些快速简单的 java 程序,可以与 JIRA 交互并创建史诗、故事和问题
最佳答案
我确信这个程序可以修改/扩展并且可以优化。我正在寻找反馈。我计划添加 XML 文件,在其中可以添加所有数据,然后可以依次创建任务、史诗、故事等。
package com.xxxxxx.mavenify.HelloWorldy;
/**/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.Charsets;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.HttpClient;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONTokener;
import okhttp3.ResponseBody;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
/**
* Hello world!a
*
*/
public class App
{public static String ticket = "https://wts-jira.xxxxx.com/jira/rest/api/2/issue"; //rest/api/2/issue/
public static void main( String[] args )
{
getHashmap();
}
public static String encodedPassword()
{ return "Basic dT zU3NjI3MjpTdW1tZXIyMDE5";
}
public static String generateEpic(String summary,String componentIdNumber,String componentIdText,String applicationIDNumber,
String applicationIDText,String acceptanceCriteria1, String dueDate,String descriptionText,String issueType)
{
return new String("{\"fields\": {\"project\": {\"key\": \"WHSAR\"},\"assignee\": {\"name\":\"u576272\"},\"summary\": \""+ applicationIDText + " - Artifactory migration"+ "\",\r\n" +
"\"customfield_12703\": \"" + applicationIDText + "\", \"customfield_19545\": {\"Option id\": \"38679\",\"value\": \"Artifactory migration\"\r\n" +
"},\"customfield_10183\": 7,\"customfield_15891\": {\"Option id\": \""+ applicationIDNumber+ "\",\"value\": \""+ applicationIDText+"\"},"
+ "\"customfield_11709\": \"Receive sign-off email or message from the app team manager.\",\"duedate\": \"26-04-19\",\r\n" +
"\"description\": \""+descriptionText+"\", \"issuetype\": {\"name\": \"Epic\"}}}\r\n");
}
public static String generateUserStory(String summary,String componentIdNumber,String componentIdText,String applicationIDNumber,
String applicationIDText,String acceptanceCriteria1,String dueDate,String descriptionText,String issueType, String epicLink)
{
return new String("{\"fields\": {\"project\": {\"key\": \"WHSAR\" }, \"summary\": \"" + summary + "\", \"customfield_19545\": { \"Option id\": \""+componentIdNumber+"\",\"value\": \""+componentIdText+"\"}, \"customfield_15891\": {\r\n" +
"\"Option id\": \""+applicationIDNumber+"\",\"value\": \""+applicationIDText+"\"},\"duedate\": \"" + dueDate +"\",\"customfield_12702\":\""+epicLink+"\", \"description\": \""+ applicationIDText + " - "+ "Ensure artifactory migration is complete.\","
+ "\"customfield_11709\": \""+acceptanceCriteria1+"\",\"issuetype\": {\"name\": \"User Story\" }}}");
}
public static String generateTask(String summary,String componentIdNumber,String componentIdText,String applicationIDNumber,
String applicationIDText,String acceptanceCriteria1,String dueDate,String descriptionText,String issueType, String storyLink)
{
return new String("{\"fields\": {\"project\": { \"key\": \"WHSAR\" },\"parent\": {\"key\": \""+ storyLink +"\"},"
+ "\"customfield_15891\": {\"Option id\": \""+applicationIDNumber+"\",\"value\": \""+applicationIDText+"\" },\"summary\": \"" + applicationIDText +" - "+ summary
+ "\",\"customfield_19545\": {\"Option id\": \""+componentIdNumber+"\",\"value\": \""+componentIdText+"\"},"
+ "\"customfield_11709\": \""+acceptanceCriteria1+ "\",\"duedate\": \"26-04-19\",\"description\": \"" + applicationIDText + " - "+ descriptionText + "\",\"issuetype\": {\"id\": \"5\"}}}");
}
public static void getHashmap()
{
try {
String applicationIDNumber = "38782";
/* 38717 = IBOSS
*/
String applicationIDText = "1SOR";
String dueDate = "06-05-19";
org.json.simple.JSONObject jnew;
String issueType;
JSONParser j1 = new JSONParser();
org.json.simple.JSONObject jnew2;
org.json.simple.JSONObject jnew3;
jnew = genEpic(applicationIDNumber, applicationIDText, dueDate);
String summaryUS1 = applicationIDText + " - Ensure project kick off date and resource details from app manager.";
String summaryUS2 = applicationIDText + " - Ensure migration pre-requisites and Go/no go.";
String summaryUS3 = applicationIDText + " - Ensure artifactory migration is complete.";
String componentIdNoUS1 = "38680";
String componentIdTextUS1 ="Prerequisites";
String accepatanceCriteriaUS1 = "Acceptance of Project kick off date and the resources details from app manager.";
String accepatanceCriteriaUS2 = "Migration pre-requisites are complete and team decision of either Go /no go.";
String accepatanceCriteriaUS3 = "Receive sign-off email or message from the app team manager.";
String descriptionUS1 = "Ensure app manager has confirmed project kick off date and resource details for the application being migrated.";
String descriptionUS2 = "Ensure migration pre-requisites are complete before the application migration has started and team is clear on Go/no go.";
String descriptionUS3 = "Ensure artifactory migration is complete.";
String componentIdNoUS2 = "38682";
String componentIdTextUS2 ="Initiation";
String componentIdNoUS3 = "38681";
String componentIdTextUS3 ="Verification";
issueType ="user story";
String epicLink =jnew.values().toArray()[2].toString();
org.json.simple.JSONObject jnew1 = (org.json.simple.JSONObject)j1.parse(genIssue(summaryUS1, applicationIDNumber, applicationIDText, componentIdNoUS1,
componentIdTextUS1, accepatanceCriteriaUS1, dueDate, descriptionUS1, issueType, epicLink, ""));
System.out.println("story 1 done ->" +jnew1.values().toArray()[2].toString());
j1= new JSONParser();
jnew2 = (org.json.simple.JSONObject)j1.parse(genIssue(summaryUS2, applicationIDNumber, applicationIDText, componentIdNoUS2,
componentIdTextUS2, accepatanceCriteriaUS2, dueDate, descriptionUS2, issueType, epicLink, ""));
System.out.println("story 2 done ->" +jnew2.values().toArray()[2].toString());
j1= new JSONParser();
jnew3 = (org.json.simple.JSONObject)j1.parse(genIssue(summaryUS3, applicationIDNumber, applicationIDText, componentIdNoUS3,
componentIdTextUS3, accepatanceCriteriaUS3, dueDate, descriptionUS3, issueType, epicLink, ""));
System.out.println("story 3 done ->" + jnew3.values().toArray()[2].toString());
genTask(applicationIDNumber, applicationIDText, dueDate, jnew2.values().toArray()[2].toString(), jnew3.values().toArray()[2].toString());
}catch (Exception ex) {
//handle exception here
System.out.println(ex.toString() + " \n "+ ex.getMessage());
ex.printStackTrace();
} finally {
//Deprecated
//httpClient.getConnectionManager().shutdown();
}
}
static org.json.simple.JSONObject genEpic(String applicationIDNumber, String applicationIDText, String dueDate)
throws ParseException, IOException {
org.json.simple.JSONObject jnew;
String summaryEText = applicationIDText + " - Artifactory migration"; //1CCP
String componentIdNumber = "38679";
String componentIdText = "Artifactory migration";
String acceptanceCriteria = "Client Sign-off";
String descriptionText = applicationIDText + " - Below instructions are applicable to you or your team ONLY if you use "
+ "old artifactory instance https://wfs-artifactory.xxxxx.com. \\n It is moved to new instance - "
+ "https://artifactory-intg-b.xxxxxx.net ";
String issueType ="epic";
JSONParser j = new JSONParser();
jnew = (org.json.simple.JSONObject)j.parse(genIssue(summaryEText, applicationIDNumber, applicationIDText, componentIdNumber,
componentIdText, acceptanceCriteria, dueDate, descriptionText, issueType, "", ""));
//{"customfield_15891":"Option id 'null' is not valid"}
System.out.println("epic done " + applicationIDText + " -> " + jnew.values().toArray()[2].toString());
return jnew;
}
static void genTask(String applicationIDNumber, String applicationIDText, String dueDate,
String storyLink2, String storyLink3) throws ParseException, IOException {
String issueType;
String summaryT1 = "Ensure dev-lead acceptance of migration documentation";
String componentIdT1 = "38684";
String componentTextT1 = "Documentation";
//appID and text
String acceptanceCriteriaT1 = "Confirmation from the dev-lead that migration document is received.";
String descriptionT1 ="Ensure dev-lead has received the migration documentation.";
String summaryT2 = "Identify application dependencies.";
String componentIdT2 = "38679";
String componentTextT2 = "Artifactory migration";
//appID and text
String acceptanceCriteriaT2 = "Document application dependencies in the sub-task:";
String descriptionT2 ="Identify application dependencies - set of questionnaire \\n " +
"1. if job touches AHP, MAVEN, Gradle, nuget, npm, promethus, nexus.\\n " +
"2. If other applications are dependent on application in scope - if so how many of them and what are they? \\n ";
String summaryT3 = "Ensure successful local build";
String componentIdT3 = "38683";
String componentTextT3 = "CI (Continuous Integration)";
//appID and text
String acceptanceCriteriaT3 = "email or message from SME or app team that local builds are successful";
String descriptionT3 ="Ensure successful local build. Here is the documentation:"
+ "https://confluence.xxxxx.net/display/WBT/Gradle+User+Set+Up+for+using+INTG \\n "
+ "https://confluence.xxxxxx.net/display/WBT/Maven+User+Set+Up+for+using+INTG \\n"
+ "https://confluence.xxxxxxx.net/display/WBT/Nuget+User+Set+Up+for+using+INTG \\n"
+ "https://confluence.xxxxxxx.net/display/WBT/NPM+User+Set+Up+for+using+INTG";
String summaryT4 = "Ensure successful build from jenkin job";
String componentIdT4 = "38683";
String componentTextT4 = "CI (Continuous Integration)";
//appID and text
String acceptanceCriteriaT4 = "Receive sign-off or message from app team that jenkins builds are good.";
String descriptionT4 ="Ensure successful build from jenkin job.";
issueType ="task";
JSONParser j1 = new JSONParser();
System.out.println("sub task 1 done ->" + ((org.json.simple.JSONObject)j1.parse(genIssue(summaryT1, applicationIDNumber, applicationIDText,
componentIdT1,componentTextT1, acceptanceCriteriaT1, dueDate, descriptionT1, issueType, "", storyLink2))).values().toArray()[2].toString());
j1= new JSONParser();
System.out.println("sub task 2 done ->" + ((org.json.simple.JSONObject)j1.parse(genIssue(summaryT2, applicationIDNumber, applicationIDText,
componentIdT2,componentTextT2, acceptanceCriteriaT2, dueDate, descriptionT2, issueType, "", storyLink2))).values().toArray()[2].toString());
j1= new JSONParser();
System.out.println("sub task 3 done ->" + ((org.json.simple.JSONObject)j1.parse(genIssue(summaryT3, applicationIDNumber, applicationIDText,
componentIdT3,componentTextT3, acceptanceCriteriaT3, dueDate, descriptionT3, issueType, "", storyLink3))).values().toArray()[2].toString());
j1= new JSONParser();
System.out.println("sub task 4 done ->" + ((org.json.simple.JSONObject)j1.parse(genIssue(summaryT4, applicationIDNumber, applicationIDText,
componentIdT4,componentTextT4, acceptanceCriteriaT4, dueDate, descriptionT4, issueType, "", storyLink3))).values().toArray()[2].toString());
}
static String genIssue(String summary, String applicationIDNumber, String applicationIDText, String componentIdNumber,
String componentIdText, String acceptanceCriteria,String dueDate, String descriptionText, String issueType, String epicLink,String storyLink)
throws IOException {
String jsonString = "";
if(issueType == "epic")
jsonString = generateEpic(summary,componentIdNumber,componentIdText,applicationIDNumber,
applicationIDText,acceptanceCriteria,dueDate,descriptionText, issueType);
else if(issueType =="user story")
jsonString = generateUserStory(summary, componentIdNumber, componentIdText, applicationIDNumber,
applicationIDText,acceptanceCriteria, dueDate, descriptionText, issueType, epicLink);
else if(issueType == "task")
jsonString = generateTask(summary, componentIdNumber, componentIdText, applicationIDNumber,
applicationIDText,acceptanceCriteria, dueDate, descriptionText, issueType, storyLink);
OkHttpClient client1 = new OkHttpClient();
MediaType mediaType1 = MediaType.parse("application/json");
RequestBody body1 = RequestBody.create(mediaType1,jsonString);
Request request1 = new Request.Builder()
.url("https://wts-jira.xxxxxx.com/rest/api/2/issue")
.post(body1)
.addHeader("Authorization", "Basic dTU3NjI3MjpTdW1tZXIyMDE5")
.addHeader("Content-Type", "application/json")
.addHeader("cache-control", "no-cache")
.build();
Response response1 = client1.newCall(request1).execute();
return response1.body().string();
}
}
这是 POM.XML
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxxxxx.mavenify</groupId>
<artifactId>HelloWorldy</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>HelloWorldy</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.9</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.7</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.9.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
关于java - 快速简单的 Java 程序,可与 JIRA 对话并创建史诗、故事和问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56572606/
关闭。这个问题是off-topic .它目前不接受答案。 想要改进这个问题? Update the question所以它是on-topic用于堆栈溢出。 关闭 12 年前。 Improve thi
我有一个动态网格,其中的数据功能需要正常工作,这样我才能逐步复制网格中的数据。假设在第 5 行中,我输入 10,则从第 6 行开始的后续行应从 11 开始读取,依此类推。 如果我转到空白的第一行并输入
我有一个关于我的按钮消失的问题 我已经把一个图像作为我的按钮 用这个函数动画 function example_animate(px) { $('#cont
我有一个具有 Facebook 连接和经典用户名/密码登录的网站。目前,如果用户单击 facebook_connect 按钮,系统即可运行。但是,我想将现有帐户链接到 facebook,因为用户可以选
我有一个正在为 iOS 开发的应用程序,该应用程序执行以下操作 加载和设置注释并启动核心定位和缩放到位置。 map 上有很多注释,从数据加载不会花很长时间,但将它们实际渲染到 map 上需要一段时间。
我被推荐使用 Heroku for Ruby on Rails 托管,到目前为止,我认为我真的会喜欢它。只是想知道是否有人可以帮助我找出问题所在。 我按照那里的说明在该网站上创建应用程序,创建并提交
我看过很多关于 SSL 错误的帖子和信息,我自己也偶然发现了一个。 我正在尝试使用 GlobalSign CA BE 证书通过 Android WebView 访问网页,但出现了不可信错误。 对于大多
我想开始使用 OpenGL 3+ 和 4,但我在使用 Glew 时遇到了问题。我试图将 glew32.lib 包含在附加依赖项中,并且我已将库和 .dll 移动到主文件夹中,因此不应该有任何路径问题。
我已经盯着这两个下载页面的源代码看了一段时间,但我似乎找不到问题。 我有两个下载页面,一个 javascript 可以工作,一个没有。 工作:http://justupload.it/v/lfd7不是
我一直在使用 jQuery,只是尝试在单击链接时替换文本字段以及隐藏/显示内容项。它似乎在 IE 中工作得很好,但我似乎无法让它在 FF 中工作。 我的 jQuery: $(function() {
我正在尝试为 NDK 编译套接字库,但出现以下两个错误: error: 'close' was not declared in this scope 和 error: 'min' is not a m
我正在使用 Selenium 浏览器自动化框架测试网站。在测试过程中,我切换到特定的框架,我们将其称为“frame_1”。后来,我在 Select 类中使用了 deselectAll() 方法。不久之
我正在尝试通过 Python 创建到 Heroku PostgreSQL 数据库的连接。我将 Windows10 与 Python 3.6.8 和 PostgreSQL 9.6 一起使用。 我从“ht
我有一个包含 2 列的数据框,我想根据两列之间的比较创建第三列。 所以逻辑是:第 1 列 val = 3,第 2 列 val = 4,因此新列值什么都没有 第 1 列 val = 3,第 2 列 va
我想知道如何调试 iphone 5 中的 css 问题。 我尝试使用 firelite 插件。但是从纵向旋转到横向时,火石占据了整个屏幕。 有没有其他方法可以调试 iphone 5 中的 css 问题
所以我有点难以理解为什么这不起作用。我正在尝试替换我正在处理的示例站点上的类别复选框。我试图让它做以下事情:未选中时以一种方式出现,悬停时以另一种方式出现(选中或未选中)选中时以第三种方式出现(而不是
Javascript CSS 问题: 我正在使用一个文本框来写入一个 div。我使用以下 javascript 获取文本框来执行此操作: function process_input(){
你好,我很难理解 P、NP 和多项式时间缩减的主题。我试过在网上搜索它并问过我的一些 friend ,但我没有得到任何好的答案。 我想问一个关于这个话题的一般性问题: 设 A,B 为 P 中的语言(或
你好,我一直在研究 https://leetcode.com/problems/2-keys-keyboard/并想到了这个动态规划问题。 您从空白页上的“A”开始,完成后得到一个数字 n,页面上应该
我正在使用 Cocoapods 和 KIF 在 Xcode 服务器上运行持续集成。我已经成功地为一个项目设置了它来报告每次提交。我现在正在使用第二个项目并收到错误: Bot Issue: warnin
我是一名优秀的程序员,十分优秀!