Skip to content

Commit 3013ce9

Browse files
committed
[NCL-5391] understand dot and comma characters in nonOSGi qualifiers
1 parent ab3c5d8 commit 3013ce9

File tree

6 files changed

+53
-3
lines changed

6 files changed

+53
-3
lines changed

common/src/main/java/org/jboss/da/common/version/VersionParser.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ private SuffixedVersion parseVersion(Matcher versionMatcher, String version, Str
5656
int major = parseNumberString(majorString);
5757
int minor = parseNumberString(minorString);
5858
int micro = parseNumberString(microString);
59-
String qualifier = qualifierString == null ? "" : qualifierString;
59+
String qualifier = qualifierString == null ? "" : qualifierString.replace('.', '-')
60+
.replace(',', '-');
6061
if (suffixVersionString == null) {
6162
return new SuffixedVersion(major, minor, micro, qualifier, version);
6263
} else {

common/src/test/java/org/jboss/da/common/version/VersionAnalyzerTest.java

+16-2
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,26 @@ public class VersionAnalyzerTest {
5555

5656
private static final String NON_OSGI_VERSION_2_RHT = "1.3.0.Final-redhat-7";
5757

58+
private static final String NON_OSGI_VERSION_3 = "1.2.3.foo.bar.baz";
59+
60+
private static final String NON_OSGI_VERSION_3_RHT = "1.2.3.foo-bar-baz-redhat-5";
61+
62+
private static final String NON_OSGI_VERSION_4 = "1.5.9.foo,bar,baz";
63+
64+
private static final String NON_OSGI_VERSION_4_RHT = "1.5.9.foo-bar-baz-redhat-8";
65+
5866
private static final List<String> All_VERSIONS = Arrays.asList(OTHER_RH_VERSION_1,
5967
OTHER_RH_VERSION_2, NO_BUILT_VERSION_2, NO_BUILT_VERSION, OTHER_RH_VERSION_3,
6068
MULTI_BUILT_VERSION_RH2, BUILT_VERSION_RH, MULTI_BUILT_VERSION_RH1, BUILT_VERSION_2_RH,
6169
MULTI_BUILT_VERSION_RH_BEST, MULTI_BUILT_VERSION_RH4, NON_OSGI_VERSION,
62-
NON_OSGI_VERSION_RHT, BUILT_VERSION_2, NON_OSGI_VERSION_2, NON_OSGI_VERSION_2_RHT);
70+
NON_OSGI_VERSION_RHT, BUILT_VERSION_2, NON_OSGI_VERSION_2, NON_OSGI_VERSION_2_RHT,
71+
NON_OSGI_VERSION_3, NON_OSGI_VERSION_3_RHT, NON_OSGI_VERSION_4, NON_OSGI_VERSION_4_RHT);
6372

6473
private static final List<String> BUILT_VERSIONS = Arrays.asList(OTHER_RH_VERSION_1,
6574
OTHER_RH_VERSION_2, OTHER_RH_VERSION_3, MULTI_BUILT_VERSION_RH2, BUILT_VERSION_RH,
6675
MULTI_BUILT_VERSION_RH1, BUILT_VERSION_2_RH, MULTI_BUILT_VERSION_RH_BEST,
67-
MULTI_BUILT_VERSION_RH4, NON_OSGI_VERSION_RHT, NON_OSGI_VERSION_2_RHT);
76+
MULTI_BUILT_VERSION_RH4, NON_OSGI_VERSION_RHT, NON_OSGI_VERSION_2_RHT,
77+
NON_OSGI_VERSION_3_RHT, NON_OSGI_VERSION_4_RHT);
6878

6979
@Test
7080
public void getBestMatchVersionForNonExistingGAV() throws CommunicationException {
@@ -102,6 +112,10 @@ public void getBestMatchVersionForNoOSGIGAV() throws CommunicationException {
102112
All_VERSIONS.toArray(new String[All_VERSIONS.size()]));
103113
checkBMV(NON_OSGI_VERSION_2_RHT, NON_OSGI_VERSION_2,
104114
All_VERSIONS.toArray(new String[All_VERSIONS.size()]));
115+
checkBMV(NON_OSGI_VERSION_3_RHT, NON_OSGI_VERSION_3,
116+
All_VERSIONS.toArray(new String[All_VERSIONS.size()]));
117+
checkBMV(NON_OSGI_VERSION_4_RHT, NON_OSGI_VERSION_4,
118+
All_VERSIONS.toArray(new String[All_VERSIONS.size()]));
105119
}
106120

107121
@Test

testsuite/src/test/java/org/jboss/da/test/client/rest/reports/BugReporoducerRemoteTest.java

+11
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,15 @@ public void testDA179() throws Exception {
4545

4646
assertEquals(200, response.getStatus());
4747
}
48+
49+
@Test
50+
public void testNCL5377() throws Exception {
51+
String nonOSGiDependency = "NCL5377";
52+
File jsonRequestFile = getJsonRequestFile(PATH_SCM, nonOSGiDependency);
53+
54+
Response response = createClientRequest(PATH_SCM).post(
55+
Entity.json(FileUtils.readFileToString(jsonRequestFile, ENCODING)));
56+
57+
assertEquals(200, response.getStatus());
58+
}
4859
}

testsuite/src/test/resources/wiremock/__files/body-jansi-maven-metadata.xml-2ADql.xml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<version>1.9.0.redhat-5</version>
1515
<version>1.11</version>
1616
<version>1.11.0.redhat-1</version>
17+
<version>3.0.0.fuse-jdk11-800011-temporary-redhat-00001</version>
1718
</versions>
1819
<lastUpdated>20170512214659</lastUpdated>
1920
</versioning>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
{
3+
"bestMatchVersion": "3.0.0.fuse-jdk11-800011-temporary-redhat-00001",
4+
"availableVersions": ["3.0.0.fuse-jdk11-800011-temporary-redhat-00001",
5+
"1.11.0.redhat-1", "1.9.0.redhat-5", "1.9.redhat-4", "1.9.redhat-3",
6+
"1.9-redhat-1"],
7+
"blacklisted": false,
8+
"whitelisted": [],
9+
"groupId": "org.fusesource.jansi",
10+
"artifactId": "jansi",
11+
"version": "3.3.5.fuse.jdk11-800013"
12+
}
13+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"versionSuffix": "temporary-redhat",
3+
"gavs": [
4+
{
5+
"groupId": "org.fusesource.jansi",
6+
"artifactId": "jansi",
7+
"version": "3.3.5.fuse.jdk11-800013"
8+
}
9+
]
10+
}

0 commit comments

Comments
 (0)