Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync Java 17 changes with main #84

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
077c3cf
Migrate to Java 17
gabilang Jun 26, 2023
5ababcb
Merge pull request #67 from gabilang/java_17_migration
warunalakshitha Jun 26, 2023
6b396b2
Fix spotbugs issues
warunalakshitha Jun 26, 2023
0f76a06
Bump workflow actions versions
warunalakshitha Jun 26, 2023
800d7cf
Merge pull request #68 from warunalakshitha/java17-migration
warunalakshitha Jun 26, 2023
1d08c8f
Add required dependencies for integration tests
gabilang Jul 4, 2023
891d4a2
Merge pull request #74 from gabilang/add-dependencies
warunalakshitha Jul 5, 2023
a1cc067
Fix sealed class access for Java 17
gabilang Jul 5, 2023
a843866
Merge pull request #75 from gabilang/fix-sealed-class-error
warunalakshitha Jul 5, 2023
77d395f
Fix missing issue with sealed class conversion
gabilang Jul 5, 2023
0b5e413
Merge pull request #76 from gabilang/fix-missing-sealed-class
warunalakshitha Jul 5, 2023
e064ce0
[Automated] Update the native jar versions
gabilang Jul 5, 2023
8730ebb
Disable test cases temporarily
gabilang Jul 6, 2023
f0eea5a
Revert the automated commit
gabilang Jul 6, 2023
d5d96c4
Merge pull request #77 from gabilang/disable-tests
warunalakshitha Jul 6, 2023
9516ca3
Fix observe tests
warunalakshitha Jul 6, 2023
92c92df
Fix API change
warunalakshitha Jul 6, 2023
64b95b4
Fix integration test
warunalakshitha Jul 6, 2023
af78dc0
Revert API change
warunalakshitha Jul 6, 2023
d3b9d4a
Fix tests
warunalakshitha Jul 8, 2023
56b3c4b
Fix metrics tests
warunalakshitha Jul 8, 2023
4f75d0f
[Automated] Update the native jar versions
gabilang Jul 8, 2023
cd61e52
Merge branch 'java_17_migration'
gabilang Jul 8, 2023
4734b23
[Automated] Update the native jar versions
gabilang Jul 9, 2023
c33dbfb
Disable failing integration test cases temporarily
gabilang Jul 9, 2023
72c9403
Revert dependencies.toml changes
gabilang Jul 9, 2023
fd24903
Merge pull request #82 from gabilang/fix-intg-tests-java17
gabilang Jul 9, 2023
38df92c
Fix oracle jdk download link
gabilang Jul 14, 2023
1e573c0
Downgrade gradle version
gabilang Jul 14, 2023
b24d9bb
Merge pull request #83 from gabilang/fix-jdk-download-link
gabilang Jul 16, 2023
bbe0a93
Merge branch 'main' and fix conflicts
gabilang Jul 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build-timestamped-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
if: github.repository_owner == 'ballerina-platform'
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
java-version: 17
- name: Change to Timestamped Version
run: |
startTime=$(TZ="Asia/Kolkata" date +'%Y%m%d-%H%M00')
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
java-version: 17
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
java-version: 17
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand All @@ -28,12 +28,12 @@ jobs:
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
java-version: 17
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand All @@ -48,12 +48,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
java-version: 17
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
name: Build on Ubuntu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
java-version: 17
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ This module contains internal configurations and initializations for Ballerina o

### Set Up the prerequisites

1. Download and install Java SE Development Kit (JDK) version 11 (from one of the following locations).
1. Download and install Java SE Development Kit (JDK) version 17 (from one of the following locations).

* [Oracle](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html)
* [Oracle](https://www.oracle.com/java/technologies/downloads/)

* [OpenJDK](https://adoptopenjdk.net/)

Expand Down
4 changes: 2 additions & 2 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ name = "observe"
version = "1.1.0"
distribution = "2201.7.0"

[platform.java11]
[platform.java17]
graalvmCompatible = true

[[platform.java11.dependency]]
[[platform.java17.dependency]]
path = "../native/build/libs/observe-internal-native-1.1.0.jar"
1 change: 1 addition & 0 deletions ballerina/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,4 @@ test.dependsOn ":observe-internal-native:build"

publishToMavenLocal.dependsOn build
publish.dependsOn build
build.dependsOn(':observe-ballerina:generatePomFileForMavenPublication')
4 changes: 2 additions & 2 deletions build-config/checkstyle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ apply plugin: 'java'

task downloadCheckstyleRuleFiles(type: Download) {
src([
'https://github.com/raw/wso2/code-quality-tools/v1.3/checkstyle/checkstyle.xml',
'https://github.com/raw/wso2/code-quality-tools/v1.3/checkstyle/suppressions.xml'
'https://github.com/raw/wso2/code-quality-tools/v1.4/checkstyle/jdk-17/checkstyle.xml',
'https://github.com/raw/wso2/code-quality-tools/v1.4/checkstyle/jdk-17/suppressions.xml'
])
overwrite false
onlyIfNewer true
Expand Down
4 changes: 2 additions & 2 deletions build-config/resources/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ name = "observe"
version = "@toml.version@"
distribution = "2201.7.0"

[platform.java11]
[platform.java17]
graalvmCompatible = true

[[platform.java11.dependency]]
[[platform.java17.dependency]]
path = "../native/build/libs/observe-internal-native-@project.version@.jar"
2 changes: 1 addition & 1 deletion build-config/resources/testobserve/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ org = "ballerina"
name = "testobserve"
version = "0.0.0"

[[platform.java11.dependency]]
[[platform.java17.dependency]]
path = "../native/build/libs/testobserve-native-@project.version@-all.jar"
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/

plugins {
id "com.github.spotbugs" version "4.2.3"
id "com.github.johnrengelman.shadow" version "5.2.0"
id "de.undercouch.download" version "4.0.4"
id "com.github.spotbugs" version "5.0.14"
id "com.github.johnrengelman.shadow" version "7.1.2"
id "de.undercouch.download" version "5.4.0"
id "net.researchgate.release" version "2.8.0"
}

Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ version=1.1.0

ballerinaLangVersion= 2201.7.0
ballerinaTomlParserVersion=1.2.2
ballerinaGradlePluginVersion=0.14.2
puppycrawlCheckstyleVersion=8.18
ballerinaGradlePluginVersion=2.0.0
puppycrawlCheckstyleVersion=10.12.0
openTelemetryVersion=1.7.0
nettyCodecVersion=4.1.77.Final
gsonVersion=2.8.8
gsonVersion=2.10.1

observeVersion=1.1.0

# Test Dependency Versions
testngVersion=7.4.0
testngVersion=7.6.1
slf4jVersion=1.7.26
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 5 additions & 2 deletions integration-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ dependencies {
testImplementation group: 'org.ballerinalang', name: 'ballerina-metrics-extension',
version: "${ballerinaLangVersion}"
implementation group: 'org.testng', name: 'testng', version: "${testngVersion}"
testImplementation "com.google.code.gson:gson:${gsonVersion}"
testImplementation group: 'org.ballerinalang', name: 'identifier-util', version: "${ballerinaLangVersion}"
}

def ballerinaDist = "build/target/extracted-distributions"
Expand Down Expand Up @@ -130,12 +132,13 @@ jacocoTestReport {
dependsOn copyBallerinaClassFiles
additionalClassDirs files(classFilesArray)
reports {
xml.enabled true
html.enabled true
xml.required = true
html.required = true
}
}

test {
jvmArgs = ['--add-opens=java.base/java.time=ALL-UNNAMED']
dependsOn createServerZip
finalizedBy jacocoTestReport
useTestNG() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.ballerinalang.test.context.Utils;

import java.io.IOException;
import java.net.InetAddress;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -58,7 +59,7 @@ protected void setupServer(String testProject, String packageName, int[] require
// Don't use 9898 port here. It is used in metrics test cases.
servicesServerInstance = new BServerInstance(balServer);
servicesServerInstance.startServer(sourcesDir, packageName, null, null, env, requiredPorts);
Utils.waitForPortsToOpen(requiredPorts, 1000 * 60, false, "localhost");
Utils.waitForPortsToOpen(requiredPorts, 1000 * 60, false, InetAddress.getByName("localhost"));
}

protected void cleanupServer() throws BallerinaTestException, IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ private void testFunctionResponseTimeGaugeSnapshotPercentile(long invocationCoun
}
}

@Test
@Test(enabled = false)
public void testMainFunction() throws Exception {
String fileName = "01_main_function.bal";

Expand All @@ -355,7 +355,7 @@ public void testMainFunction() throws Exception {
);
}

@Test
@Test(enabled = false)
public void testResourceFunction() throws Exception {
String fileName = "02_resource_function.bal";
String serviceName = "/testServiceOne";
Expand Down Expand Up @@ -405,7 +405,7 @@ public void testResourceFunction() throws Exception {
);
}

@Test
@Test(enabled = false)
public void testPathsWithEscapeCharacters() throws Exception {
String fileName = "02_resource_function.bal";
String serviceName = "/this\\-is\\-service\\-path/still\\-service\\-path";
Expand Down Expand Up @@ -440,7 +440,7 @@ public void testPathsWithEscapeCharacters() throws Exception {
);
}

@Test
@Test(enabled = false)
public void testWorkers() throws Exception {
String fileName = "02_resource_function.bal";
String serviceName = "/testServiceOne";
Expand Down Expand Up @@ -494,7 +494,7 @@ public void testWorkers() throws Exception {
);
}

@Test
@Test(enabled = false)
public void testCustomMetricTags() throws Exception {
String fileName = "03_custom_metric_tags.bal";
String serviceName = "/testServiceTwo";
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

plugins {
id "com.gradle.enterprise" version "3.2"
id "com.gradle.enterprise" version "3.13.2"
}

rootProject.name = 'module-ballerinai-observe'
Expand Down
2 changes: 1 addition & 1 deletion testobserve/ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ org = "ballerina"
name = "testobserve"
version = "0.0.0"

[[platform.java11.dependency]]
[[platform.java17.dependency]]
path = "../native/build/libs/testobserve-native-1.1.0-all.jar"
29 changes: 29 additions & 0 deletions testobserve/native/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--
~ Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<FindBugsFilter>
<Match>
<Class name="org.ballerina.testobserve.listenerendpoint.Resource"/>
<Field name="serviceObject"/>
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>
</Match>
<Match>
<Class name="org.ballerina.testobserve.listenerendpoint.WebServer$WebServerInboundHandler"/>
<Field name="resourceMap"/>
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ public String getAccessor() {
return this.resourceMethodType.getAccessor();
}

public String getResourcePath() {
public final String getResourcePath() {
return Utils.normalizeResourcePath(basePath)
+ Utils.normalizeResourcePath(String.join("/", this.resourceMethodType.getResourcePath()));
}

public Type[] getParamTypes() {
public final Type[] getParamTypes() {
Parameter[] parameters = this.resourceMethodType.getParameters();
Type[] types = new Type[parameters.length];
for (int i = 0; i < parameters.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@
import org.testng.annotations.Test;

import java.io.File;
import java.net.InetAddress;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.logging.Logger;

import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;

/**
* Test cases for listener written to be used in unit tests.
*/
Expand All @@ -60,7 +59,7 @@ private void setup() throws Exception {
"listener_tests").getAbsolutePath();
int[] requiredPorts = {29091};
servicesServerInstance.startServer(sourcesDir, "listener_tests", null, new String[0], requiredPorts);
Utils.waitForPortsToOpen(requiredPorts, 1000 * 60, false, "localhost");
Utils.waitForPortsToOpen(requiredPorts, 1000 * 60, false, InetAddress.getByName("localhost"));
}

@AfterClass
Expand Down
Loading