diff --git a/pom.xml b/pom.xml index 565093d..0bb9b1c 100644 --- a/pom.xml +++ b/pom.xml @@ -1,384 +1,384 @@ - - - - 4.0.0 - - com.microfocus.adm.almoctane.bdd - bdd2octane - 1.1.4-SNAPSHOT - maven-plugin - - bdd2octane - a standalone java-based tool that enables customer to import BDD test result into Octane - https://github.com/MicroFocus/bdd2octane - - - - The Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - - - Jack Zhou - jzhou2@opentext.com - OpenText - http://www.microfocus.com/opentext - - - - - - scm:git:git://github.com:MicroFocus/bdd2octane.git - scm:git:ssh://github.com:MicroFocus/bdd2octane.git - https://github.com/MicroFocus/bdd2octane/tree/master - - - - - ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - UTF-8 - 1.8 - 1.8 - - - - - io.cucumber - gherkin - 19.0.3 - - - io.cucumber - messages - 16.0.1 - - - junit - junit - 4.13.1 - test - - - org.reflections - reflections - 0.9.12 - - - org.apache.ant - ant - 1.10.11 - - - com.google.guava - guava - 30.0-jre - - - xmlunit - xmlunit - 1.6 - - - org.apache.maven - maven-plugin-api - 3.5.0 - - - org.apache.maven.plugin-tools - maven-plugin-annotations - 3.6.0 - - - - - - - - - maven-clean-plugin - 3.1.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.8.0 - - -Xlint:all - - - - maven-surefire-plugin - 2.22.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - maven-site-plugin - 3.7.1 - - - maven-project-info-reports-plugin - 3.0.0 - - - maven-assembly-plugin - 3.3.0 - - - maven-failsafe-plugin - 3.0.0-M5 - - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - 3.0.0-M5 - - - - integration-test - verify - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.1 - - - **/*ITCase.java - - -Dfile.encoding=UTF-8 - - - - org.apache.maven.plugins - maven-assembly-plugin - 3.3.0 - - - package - - single - - - - - - com.microfocus.bdd.App - - - - - jar-with-dependencies - - - - - - - org.apache.maven.plugins - maven-plugin-plugin - 3.6.0 - - - default-descriptor - process-classes - - - - bdd2octane - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.9.1 - - - attach-javadocs - - jar - - - - - - - - src/main/resources - true - - - - - - sign - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - true - - ossrh - https://s01.oss.sonatype.org/ - true - - - - - - - - build-deployment - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.9.1 - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - test-jar - - - - - ${project.artifactId}-${project.version} - - - - - - - - maven-source-plugin - org.apache.maven.plugins - - - - - - - - release - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - true - - release-repository - https://oss.sonatype.org/ - true - - - - - - - - snapshot - - - snapshot-repository - Maven2 Snapshot Repository - https://oss.sonatype.org/content/repositories/snapshots - false - - - - - - ossrh - - true - - - gpg2 - https://github.com/HPSoftware/bdd2octane - - - - - + + + + 4.0.0 + + com.microfocus.adm.almoctane.bdd + bdd2octane + 1.1.5 + maven-plugin + + bdd2octane + a standalone java-based tool that enables customer to import BDD test result into Octane + https://github.com/MicroFocus/bdd2octane + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + Jack Zhou + jzhou2@opentext.com + OpenText + http://www.microfocus.com/opentext + + + + + + scm:git:git://github.com:MicroFocus/bdd2octane.git + scm:git:ssh://github.com:MicroFocus/bdd2octane.git + https://github.com/MicroFocus/bdd2octane/tree/master + + + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + UTF-8 + 1.8 + 1.8 + + + + + io.cucumber + gherkin + 19.0.3 + + + io.cucumber + messages + 16.0.1 + + + junit + junit + 4.13.1 + test + + + org.reflections + reflections + 0.9.12 + + + org.apache.ant + ant + 1.10.11 + + + com.google.guava + guava + 30.0-jre + + + xmlunit + xmlunit + 1.6 + + + org.apache.maven + maven-plugin-api + 3.5.0 + + + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.6.0 + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + -Xlint:all + + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + maven-assembly-plugin + 3.3.0 + + + maven-failsafe-plugin + 3.0.0-M5 + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 3.0.0-M5 + + + + integration-test + verify + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.1 + + + **/*ITCase.java + + -Dfile.encoding=UTF-8 + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.3.0 + + + package + + single + + + + + + com.microfocus.bdd.App + + + + + jar-with-dependencies + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + 3.6.0 + + + default-descriptor + process-classes + + + + bdd2octane + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + + + src/main/resources + true + + + + + + sign + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ossrh + https://s01.oss.sonatype.org/ + true + + + + + + + + build-deployment + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + test-jar + + + + + ${project.artifactId}-${project.version} + + + + + + + + maven-source-plugin + org.apache.maven.plugins + + + + + + + + release + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + release-repository + https://oss.sonatype.org/ + true + + + + + + + + snapshot + + + snapshot-repository + Maven2 Snapshot Repository + https://oss.sonatype.org/content/repositories/snapshots + false + + + + + + ossrh + + true + + + gpg2 + https://github.com/HPSoftware/bdd2octane + + + + + diff --git a/src/main/java/com/microfocus/bdd/FeatureFileLocator.java b/src/main/java/com/microfocus/bdd/FeatureFileLocator.java index eae7313..bdc8d72 100644 --- a/src/main/java/com/microfocus/bdd/FeatureFileLocator.java +++ b/src/main/java/com/microfocus/bdd/FeatureFileLocator.java @@ -140,35 +140,36 @@ private Optional parseLanguage(String line) { private Optional tryToGetFeatureFileMeta(String featureName, String featureFile) throws IOException { FeatureFileMeta featureFileMeta = new FeatureFileMeta(featureFile, GherkinMultiLingualService.DEFAULT_LANGUAGE); - BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(featureFile), "UTF8")); Pattern pattern = Pattern.compile("^#\\s*language"); - List translatedFeatureNames; - while (true) { - String line = reader.readLine(); - if (line == null) { - break; - } - if (pattern.matcher(line).find()) { - parseLanguage(line).ifPresent(lang -> featureFileMeta.setLanguage(lang)); - continue; - } - if (line.startsWith("#")) { - continue; - } - translatedFeatureNames = new GherkinDialectProvider(featureFileMeta.getLanguage()) - .getDialect(featureFileMeta.getLanguage(), null).getFeatureKeywords(); - if (translatedFeatureNames.stream().anyMatch(line::contains)) { - String[] featureNamePattern = line.split(":", 2); - if (featureNamePattern.length >= 2) { - String fName = featureNamePattern[1].trim(); - featureNameToFeatureFileMetaMap.putIfAbsent(fName, featureFileMeta); - featureFiles.remove(fName); - if (fName.equals(featureName)) { - return Optional.of(featureFileMeta); + try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(featureFile), "UTF8"))) { + List translatedFeatureNames; + while (true) { + String line = reader.readLine(); + if (line == null) { + break; + } + if (pattern.matcher(line).find()) { + parseLanguage(line).ifPresent(lang -> featureFileMeta.setLanguage(lang)); + continue; + } + if (line.startsWith("#")) { + continue; + } + translatedFeatureNames = new GherkinDialectProvider(featureFileMeta.getLanguage()) + .getDialect(featureFileMeta.getLanguage(), null).getFeatureKeywords(); + if (translatedFeatureNames.stream().anyMatch(line::contains)) { + String[] featureNamePattern = line.split(":", 2); + if (featureNamePattern.length >= 2) { + String fName = featureNamePattern[1].trim(); + featureNameToFeatureFileMetaMap.putIfAbsent(fName, featureFileMeta); + featureFiles.remove(fName); + if (fName.equals(featureName)) { + return Optional.of(featureFileMeta); + } } + break; } - break; } } return Optional.empty();