Skip to content

Commit 99f89b1

Browse files
authored
Add support for more jave vendors (#2774)
- Since java vendor was set to `adoptium`, other vendors are not recognized - Add VmPropertiesChecks for ibm to fix the smoke test failure Signed-off-by: Longyu Zhang <[email protected]>
1 parent 353ce31 commit 99f89b1

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

test/functional/buildAndPackage/src/net/adoptium/test/VendorPropertiesTest.java

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ public class VendorPropertiesTest {
5151
public VendorPropertiesTest() {
5252
Set<VmPropertiesChecks> allPropertiesChecks = new LinkedHashSet<>();
5353
allPropertiesChecks.add(new AdoptiumPropertiesChecks());
54+
allPropertiesChecks.add(new SemeruPropertiesChecks());
5455
allPropertiesChecks.add(new CorrettoPropertiesChecks());
5556

5657
// TODO: Somehow obtain the vendor name from the outside. Using any JVM properties is not a solution
5758
// because that's what we want to test here.
58-
String vendor = "Adoptium";
59+
String vendor = System.getProperty("java.vendor");
5960
this.vendorChecks = allPropertiesChecks.stream()
6061
.filter(checks -> checks.supports(vendor))
6162
.findFirst()
@@ -164,7 +165,7 @@ private static class AdoptiumPropertiesChecks implements VmPropertiesChecks {
164165

165166
@Override
166167
public boolean supports(final String vendor) {
167-
return vendor.toLowerCase(Locale.US).equals("adoptium");
168+
return vendor.toLowerCase(Locale.US).contains("adoptium");
168169
}
169170

170171
@Override
@@ -211,6 +212,51 @@ public void javaVmVersion(final String value) {
211212
}
212213
}
213214

215+
private static class SemeruPropertiesChecks implements VmPropertiesChecks {
216+
217+
@Override
218+
public boolean supports(final String vendor) {
219+
return vendor.toLowerCase(Locale.US).equals("international business machines corporation");
220+
}
221+
222+
@Override
223+
public void javaVersion(final String value) {
224+
assertTrue(value.contains("openj9"));
225+
}
226+
227+
@Override
228+
public void javaVendor(final String value) {
229+
assertEquals(value, "International Business Machines Corporation");
230+
}
231+
232+
@Override
233+
public void javaVendorUrl(final String value) {
234+
assertEquals(value, "https://www.ibm.com/semeru-runtimes");
235+
}
236+
237+
@Override
238+
public void javaVendorUrlBug(final String value) {
239+
assertEquals(value, "https://github.com/ibmruntimes/Semeru-Runtimes/issues");
240+
}
241+
242+
@Override
243+
public void javaVendorVersion(final String value) {
244+
assertNotEquals(value.replaceAll("[^0-9]", "").length(), 0,
245+
"java.vendor.version contains no numbers: " + value);
246+
}
247+
248+
@Override
249+
public void javaVmVendor(final String value) {
250+
assertTrue(value.equals("Eclipse OpenJ9"));
251+
}
252+
253+
@Override
254+
public void javaVmVersion(final String value) {
255+
assertNotEquals(value.replaceAll("[^0-9]", "").length(), 0,
256+
"java.vm.version contains no numbers: " + value);
257+
}
258+
}
259+
214260
private static class CorrettoPropertiesChecks implements VmPropertiesChecks {
215261

216262
@Override

0 commit comments

Comments
 (0)