Skip to content

Commit 9b1e9bd

Browse files
committed
Add numbered option
1 parent d4e3d04 commit 9b1e9bd

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.assertthat.plugins</groupId>
77
<artifactId>assertthat-bdd-standalone</artifactId>
8-
<version>1.9</version>
8+
<version>1.9.1</version>
99
<name>assertthat-bdd-standalone</name>
1010
<description>AssertThat BDD Jira plugin client standalone</description>
1111
<url>http://www.assertthat.com</url>

src/main/java/com/assertthat/plugins/api/Main.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ public static void main(String[] args) throws IOException, JSONException {
123123
Option featuresOption = new Option("f", "features", false, "Download features");
124124
featuresOption.setRequired(false);
125125

126+
Option numberedOption = new Option("d", "numbered", false, "Prepend ordinal to feature name");
127+
numberedOption.setRequired(false);
128+
options.addOption(numberedOption);
129+
126130
Option reportOption = new Option("r", "report", false, "Upload report");
127131
reportOption.setRequired(false);
128132

@@ -169,7 +173,8 @@ public static void main(String[] args) throws IOException, JSONException {
169173
cmd.getOptionValue("jql"),
170174
cmd.getOptionValue("tags"),
171175
cmd.getOptionValue("type"),
172-
cmd.getOptionValue("jiraServerUrl")
176+
cmd.getOptionValue("jiraServerUrl"),
177+
cmd.hasOption("numbered")
173178
);
174179

175180
APIUtil apiUtil = new APIUtil(arguments.getProjectId(), arguments.getAccessKey(), arguments.getSecretKey(), arguments.getProxyURI(), arguments.getProxyUsername(), arguments.getProxyPassword(), arguments.getJiraServerUrl());
@@ -178,7 +183,7 @@ public static void main(String[] args) throws IOException, JSONException {
178183
File inZip =
179184
apiUtil.download(new File(arguments.getOutputFolder()),
180185
arguments.getMode(), arguments.getJql() ,
181-
arguments.getTags());
186+
arguments.getTags(), arguments.isNumbered());
182187
File zip = new FileUtil().unpackArchive(inZip, new File(arguments.getOutputFolder()));
183188
zip.delete();
184189
}

src/main/java/com/assertthat/plugins/internal/APIUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static void copyInputStream(InputStream in, OutputStream out) throws IOEx
9696
}
9797

9898
public File download(File targetDir, String mode, String jql,
99-
String tags) throws IOException {
99+
String tags, boolean isNumbered) throws IOException {
100100
if (targetDir.exists()) {
101101
for (File f : targetDir.listFiles()) {
102102
if (f.getName().endsWith(".feature")) {
@@ -119,6 +119,7 @@ public File download(File targetDir, String mode, String jql,
119119
if (jql != null) {
120120
queryParams.add("jql", jql.trim());
121121
}
122+
queryParams.add("numbered", isNumbered);
122123
client.addFilter(new ClientFilter() {
123124
@Override
124125
public ClientResponse handle(ClientRequest

src/main/java/com/assertthat/plugins/internal/Arguments.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class Arguments {
4343
private String jiraServerUrl;
4444
private String type = "cucumber";
4545
private String tags;
46+
private boolean numbered;
4647

4748
public Arguments(String accessKey,
4849
String secretKey,
@@ -58,7 +59,8 @@ public Arguments(String accessKey,
5859
String jql,
5960
String tags,
6061
String type,
61-
String jiraServerUrl) {
62+
String jiraServerUrl,
63+
boolean numbered) {
6264
this.accessKey = System.getenv("ASSERTTHAT_ACCESS_KEY");
6365
this.secretKey = System.getenv("ASSERTTHAT_SECRET_KEY");
6466
if (accessKey != null && !accessKey.trim().isEmpty()) {
@@ -76,6 +78,7 @@ public Arguments(String accessKey,
7678
this.proxyPassword = proxyPassword;
7779
this.proxyUsername = proxyUsername;
7880
this.jiraServerUrl = jiraServerUrl;
81+
this.numbered = numbered;
7982

8083
if (runName != null) {
8184
this.runName = runName;
@@ -112,8 +115,9 @@ public Arguments(String accessKey,
112115
String tags,
113116
String type,
114117
String jiraServerUrl,
115-
String metadata) {
116-
this(accessKey,secretKey ,projectId,runName,outputFolder,jsonReportFolder,jsonReportIncludePattern,proxyURI,proxyUsername,proxyPassword,mode,jql,tags,type,jiraServerUrl);
118+
String metadata,
119+
boolean numbered) {
120+
this(accessKey,secretKey ,projectId,runName,outputFolder,jsonReportFolder,jsonReportIncludePattern,proxyURI,proxyUsername,proxyPassword,mode,jql,tags,type,jiraServerUrl, numbered);
117121
this.metadata = metadata;
118122

119123

@@ -245,4 +249,8 @@ public String getTags() {
245249
public void setTags(String tags) {
246250
this.tags = tags;
247251
}
252+
253+
public boolean isNumbered() {
254+
return numbered;
255+
}
248256
}

0 commit comments

Comments
 (0)