-
Notifications
You must be signed in to change notification settings - Fork 463
Introduce JDK 21 compilation support #2433
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
base: master
Are you sure you want to change the base?
Conversation
As part of the effort, the following changes have been done. - Migrated Unit tests from PowerMockito to Mockito - Due Mockito limitations, some two testcase files (RequestResponseTest.java & NHttpTransportListenerTest.java) have been removed. - NashornJS related implementation are removed. - ScriptMediator tests related Ruby language have been commented. - Since jaxb-api dependency is outdated, jakarta.xml.bind-api dependency is used instead. - Jacoco agent dependency was updated from 0.8.6 to 0.8.12. - Maven war plugin version was increased from 2.6 to 3.5.0 - Glassfish jersey dependency used in unit test was updated from 2.35 to 2.41.
WalkthroughThis pull request modernizes the Apache Synapse codebase by migrating from javax.xml.bind (JAXB) to jakarta.xml.bind, replacing PowerMock test framework with Mockito, upgrading Java target to version 21, removing Nashorn JavaScript support in favor of GraalVM, updating build tooling versions, and adapting shell scripts for Java 9+ endorsed directory handling. Changes
Sequence Diagram(s)sequenceDiagram
participant Code as Application Code
participant DS as DataSourceFinder
participant JNDICtx as JNDI Context
participant NM as NamingManager
participant Ref as javax.naming.Reference
Code->>DS: find(dsName, context)
DS->>JNDICtx: lookup(dsName)
JNDICtx-->>DS: Object (may be Reference)
alt Object is null
DS-->>Code: null return
else Object is non-null
DS->>NM: getObjectInstance(object, context)
NM->>Ref: dereference if Reference
Ref-->>NM: dereferenced object
NM-->>DS: actual DataSource or object
alt Dereferenced object is DataSource
DS-->>Code: return DataSource
else Not a DataSource
DS->>DS: throw SynapseCommonsException
DS-->>Code: exception
end
end
sequenceDiagram
participant Test as Test Code
participant MockStatic as MockedStatic
participant SM as ScriptMediator
participant SE as ScriptEngine
rect rgba(200, 220, 255, 0.5)
Note over Test,SE: PowerMock Approach (Old)
Test->>Test: `@RunWith`(PowerMockRunner)
Test->>Test: `@PrepareForTest`({...})
Test->>Test: PowerMockito.mockStatic(TargetClass)
end
rect rgba(200, 255, 220, 0.5)
Note over Test,SE: Mockito Approach (New)
Test->>MockStatic: mockStatic(TargetClass)
MockStatic-->>Test: MockedStatic instance
Test->>Test: try-with-resources(MockedStatic)
Test->>SM: execute method under test
SM->>SE: use mocked static
SE-->>SM: stubbed response
SM-->>Test: result
Test->>Test: exit try-with-resources
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Areas requiring extra attention:
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
modules/tasks/src/test/java/org/apache/synapse/task/service/TaskSchedulerTest.java (1)
38-87: PowerMock migration verified; update deprecated Assert import.PowerMock removal is correct—the file contains no PowerMock imports or annotations. All mocking uses standard Mockito for instance methods (
isInitialized(),getRunningTaskCount(),schedule()), which Mockito handles natively.However, line 20 imports deprecated
junit.framework.Assert. Update toorg.junit.Assertfor consistency with JUnit 4 test framework.modules/distribution/src/main/bin/ciphertool.sh (1)
105-105: Remove dead code: unusedJAVA_ENDORSED_DIRSCygwin conversion.The conversion of
JAVA_ENDORSED_DIRSon line 105 is no longer needed since endorsed directories are now handled via classpath augmentation (lines 92–98) rather than the JVM option.CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"` fimodules/transports/core/nhttp/pom.xml (1)
244-257: Remove duplicate mockito-core dependency.The
mockito-coredependency is declared twice (lines 244-247 and 254-257), both with test scope. Remove one of the duplicate entries.Apply this diff to remove the duplicate:
<dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-inline</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency>
🧹 Nitpick comments (25)
modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java (2)
28-29: Remove or comment out unused imports.Since Sample353 and Sample354 are no longer registered in the suite (lines 277-278 are commented out), these imports are now unused and should be removed or commented out for consistency.
Apply this diff to comment out the unused imports:
-import org.apache.synapse.samples.framework.tests.advanced.Sample353; -import org.apache.synapse.samples.framework.tests.advanced.Sample354; +//import org.apache.synapse.samples.framework.tests.advanced.Sample353; +//import org.apache.synapse.samples.framework.tests.advanced.Sample354;Alternatively, remove the imports entirely if these samples won't be re-enabled.
277-278: Add explanatory comment for disabled samples.The commented lines lack context about why Sample353 and Sample354 are disabled. Adding a brief explanation would help future maintainers understand this is related to JDK 21 compatibility and Ruby language support removal.
Apply this diff to add context:
+ // Samples 353 and 354 are disabled due to Ruby language support removal in JDK 21 // sampleClassRepo.put("353", Sample353.class); // sampleClassRepo.put("354", Sample354.class);modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXTransportListenerTest.java (1)
89-89: Remove redundant mock initialization.
MockitoAnnotations.initMocks(this)is unnecessary when using@RunWith(MockitoJUnitRunner.class), which automatically initializes the@Mockand@InjectMocksannotations.Apply this diff:
- MockitoAnnotations.initMocks(this);modules/tasks/src/test/java/org/apache/synapse/task/service/TaskSchedulerTest.java (1)
21-21: Consider updating to JUnit 4 Assert.The
junit.framework.Assertclass is from JUnit 3 and deprecated. Since the tests use JUnit 4 (@Testannotation), consider updating toorg.junit.Assert.Apply this diff to modernize the import:
-import junit.framework.Assert; +import org.junit.Assert;Alternatively, use static imports for cleaner assertions:
-import junit.framework.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue;Then update the assertion calls to remove the
Assert.prefix (e.g.,assertTrue(...)instead ofAssert.assertTrue(...)).modules/distribution/src/main/bin/ciphertool.sh (1)
92-92: Add deprecation context to comment for consistency with other distribution scripts.While the comment explains what is being done, it omits context about why this pattern replaced the older approach. Other distribution scripts clarify that
-Djava.endorsed.dirswas removed in Java 9+.-# Add endorsed JARs to classpath (for Java 9+ compatibility) +# endorsed dir - Note: -Djava.endorsed.dirs is removed in Java 9+ +# Endorsed JARs are now added to classpath insteadmodules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXIncomingMessageHandlerTest.java (1)
65-65: Remove redundant mock initialization.The
initMocks(this)call is unnecessary becauseMockitoJUnitRunner(line 45) automatically initializes all@Mockannotated fields before each test method executes.Apply this diff:
@Test public void testToAdmin() throws Exception { - initMocks(this); SessionID id = new SessionID(new BeginString("FIX.4.1"), new SenderCompID("SYNAPSE"),modules/transports/optional/fix/src/main/java/org/apache/synapse/transport/fix/FIXTransportSender.java (1)
277-278: Prefer package-private over protected for test-only visibility.Since the test class resides in the same package (
org.apache.synapse.transport.fix), package-private (default) visibility would suffice and provide better encapsulation thanprotected. Theprotectedmodifier unnecessarily exposes this method to all subclasses, which may not align with the intended API surface.Apply this diff to use package-private visibility:
- protected boolean sendUsingEPR(String targetEPR, String serviceName, Message fixMessage, + boolean sendUsingEPR(String targetEPR, String serviceName, Message fixMessage, String srcSession, int counter, MessageContext msgCtx) throws AxisFault {modules/core/src/test/java/org/apache/synapse/endpoints/auth/oauth/OAuthClientTest.java (4)
42-45: Mockito runner and static mocking setup look correct; runner is optional hereUsing
MockedStaticwith a try‑with‑resources block is the right way to scope theHttpClientBuilderstatic mock, and the imports are consistent. Since this test only uses locally created mocks (no@Mock/@InjectMocksfields),@RunWith(MockitoJUnitRunner.class)is not strictly necessary, though it doesn’t hurt. You could drop the runner later to simplify the class or, conversely, migrate fully away fromjunit.framework.TestCaseto a pure JUnit 4/5 style when convenient.Also applies to: 55-55
66-79: Static mocking ofHttpClientBuilderand fluent chain matches production codeThe mocking setup for
HttpClientBuilder.create()and the fluent calls (setDefaultRequestConfig,setConnectionManager,setSSLSocketFactory,build) correctly mirrors the productiongetSecureClientWithoutProxyimplementation, and returningmockHttpClientfrombuild()plus stubbingexecute(HttpPost)is sufficient for the test to exerciseOAuthClient.generateTokenwithout hitting the network. Consider optionally adding aMockito.verify(mockHttpClient).execute(any(HttpPost.class));to ensure the test would fail if the HTTP call path is refactored away, but the current behavior is functionally sound.
80-89: Response/status stubbing is consistent and narrowly scopedStubbing the
StatusLineto return 200, attaching it tomockResponse, and providing a small JSON payload viaentity.getContent()is a clean way to drive the happy‑path token parsing. The use ofByteArrayInputStreamwith simple ASCII JSON is safe here. If you later extend coverage, you might add separate tests for non‑200 responses or malformed JSON, but that’s outside the scope of this migration.
90-101: Context setup is adequate; minor SynapseConfiguration reuse improvement possibleThe Axis2/Synapse context wiring is sufficient for
OAuthClient.generateTokento run, and the parameters (timeouts set to-1, newProxyConfigsandTrustStoreConfigs) match the expected usage. One small clean‑up: you create aSynapseConfigurationforsynapseEnvironment, then pass a newSynapseConfiguration()instance intoAxis2MessageContext. Reusing the samesynapseConfigurationinstance in both places would be slightly clearer and avoid allocating an extra config object, though behavior is currently correct.modules/core/src/test/java/org/apache/synapse/util/ResourceMapTest.java (1)
89-89: Simplify the matcher forevaluateValueThe explicit cast in
((MessageContext) any())is unnecessary; generics will infer the type. You can make this more idiomatic and type-safe as:Mockito.when(value.evaluateValue(any(MessageContext.class))).thenReturn(helloKey);This keeps the matcher type explicit and avoids the extra cast.
Please recompile the test after this tweak to confirm there are no import or overload resolution issues.
modules/commons/src/main/java/org/apache/synapse/commons/datasource/DataSourceFinder.java (1)
90-91: Consider preserving exception context in RuntimeException.The broad
Exceptioncatch wraps any non-NamingException into a bareRuntimeException, which loses the original exception message and context.Apply this diff to preserve exception details:
} catch (Exception e) { - throw new RuntimeException(e); + throw new RuntimeException("Error dereferencing DataSource: " + dsName, e); }modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/PassThroughHttpSenderTest.java (1)
36-40: Remove unused@Afterimport on line 40.The import is confirmed to be unused—no method in the test class is annotated with
@After. Removing this import will clean up the imports section.modules/core/src/test/java/org/apache/synapse/mediators/bean/Enterprise/EJBMediatorTest.java (1)
36-38: Mockito-based static mocking migration is consistent and scoped correctlyThe switch to
MockitoJUnitRunnerplusMockedStatic<BeanUtils>in a try‑with‑resources block is clean and matches the pattern used elsewhere in the suite. StubbingbeanstalkManager/beanstalkbefore callingejbMediator.init(...)and then mediating with a realAxis2MessageContextkeeps the test behaviorally equivalent to the prior PowerMock version.One minor, non‑blocking thought:
ejbMediatorandbeanstalkare static fields; if more tests are ever added to this class, you may want to make them instance fields or reinitialize in a@Beforemethod to avoid cross‑test state bleed, but this is not introduced by this PR.Please confirm the test passes under the Mockito version configured for this PR, as static mocking support is version‑sensitive.
Also applies to: 49-49, 87-105
modules/commons/src/main/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLMapper.java (1)
28-30: Jakarta JAXB switch changes public API surface – confirm this is an intentional break
JsonXMLMappernow depends onjakarta.xml.bind.JAXBContext/JAXBExceptioninstead ofjavax.xml.bind.*. Functionally this is fine and aligns with the Jakarta migration, but it does change the public API types exposed by this class, which can break external consumers compiled against the oldjavaxtypes.If this class is part of your supported public API, consider:
- Explicitly documenting this as a breaking change in release notes, and/or
- Aligning versioning (e.g., major bump) to reflect the Jakarta migration.
Please verify that all modules (and external integrations, if any) using
JsonXMLMapperare updated tojakarta.xml.bindbefore releasing this change.modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/TargetHandlerTest.java (1)
59-148: PowerMock → Mockito static mocking migration preserves behaviourThe three tests now use
try (MockedStatic<TargetContext> = mockStatic(...))with appropriate stubbing ofTargetContextstatic methods and rely on the same interaction patterns as before, so test intent and coverage are preserved while dropping PowerMock.If you ever touch these again, you might consider adding explicit
verifycalls onDeliveryAgent/TargetContextto assert behaviour rather than just “no exception”, but that’s outside this PR’s scope.modules/commons/pom.xml (2)
56-59: Jacoco plugin now declared without executionsThe
jacoco-maven-pluginis present but has no module-local<executions>; if coverage for this module is meant to be driven from the parent POM, this is fine, otherwise you may want to confirm that you’re still instrumenting and reporting coverage forsynapse-commons.If coverage drops unexpectedly for this module after the change, consider either re-adding executions here or centralising all Jacoco configuration in the parent POM.
237-247: Ensure JAXB runtime matches Jakarta APIYou’ve switched the API dependency to
jakarta.xml.bind:jakarta.xml.bind-apiwhile still depending oncom.sun.xml.bind:jaxb-coreandjaxb-impl. Please verify that the effective versions of those runtime artifacts are compatible with the Jakarta JAXB API (and not only with the legacyjavax.xml.bindAPI), otherwise you may see runtime failures when creatingJAXBContext.You can check the resolved versions and their package names (
javax.xml.bindvsjakarta.xml.bind) via your dependency tree (mvn dependency:tree) and by consulting the library documentation or release notes.modules/integration/pom.xml (1)
457-474: Mix of javax JAXB test deps and Jakarta migration—verify classpath behaviourThese new test‑scoped dependencies bring in the classic
javax.xml.bind/javax.activationstack for integration tests, while other modules (e.g. commons) now use the Jakarta JAXB API. That’s reasonable if tests still rely on javax‑based libraries, but please double‑check that:
- You don’t accidentally satisfy Jakarta
jakarta.xml.bindexpectations with only javax providers, and- There are no conflicting JAXB providers on the test classpath.
Running
mvn -pl modules/integration dependency:treeand cross‑checking provider packages (javax vs jakarta) against your usage is a good way to confirm this.modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/TargetResponseTest.java (1)
66-89: Unused mock variable in testFalse().The
targetContextMockis created but never used for stubbing or verification. If the static mock is not needed for this test, consider removing it to simplify the test.Apply this diff if the mock is not needed:
@Test public void testFalse() throws Exception { - try (MockedStatic<TargetContext> targetContextMock = mockStatic(TargetContext.class)) { - ConfigurationContext configurationContext = new ConfigurationContext(new AxisConfiguration()); - WorkerPool workerPool = new NativeWorkerPool(3, 4, 5, 5, "name", "id"); - PassThroughTransportMetricsCollector metrics = new PassThroughTransportMetricsCollector(true, "testScheme"); + ConfigurationContext configurationContext = new ConfigurationContext(new AxisConfiguration()); + WorkerPool workerPool = new NativeWorkerPool(3, 4, 5, 5, "name", "id"); + PassThroughTransportMetricsCollector metrics = new PassThroughTransportMetricsCollector(true, "testScheme"); - TargetConfiguration targetConfiguration = new TargetConfiguration(configurationContext, null, workerPool, - metrics, null); - HttpResponse response = mock(HttpResponse.class, Mockito.RETURNS_DEEP_STUBS); - NHttpClientConnection conn = mock(NHttpClientConnection.class, Mockito.RETURNS_DEEP_STUBS); - TargetConnections connections = mock(TargetConnections.class); - targetConfiguration.setConnections(connections); + TargetConfiguration targetConfiguration = new TargetConfiguration(configurationContext, null, workerPool, + metrics, null); + HttpResponse response = mock(HttpResponse.class, Mockito.RETURNS_DEEP_STUBS); + NHttpClientConnection conn = mock(NHttpClientConnection.class, Mockito.RETURNS_DEEP_STUBS); + TargetConnections connections = mock(TargetConnections.class); + targetConfiguration.setConnections(connections); - HttpRequest httpRequest = new BasicHttpRequest("GET", "test.com"); - when(conn.getContext().getAttribute("http.request")).thenReturn(httpRequest); + HttpRequest httpRequest = new BasicHttpRequest("GET", "test.com"); + when(conn.getContext().getAttribute("http.request")).thenReturn(httpRequest); - TargetResponse targetResponse = new TargetResponse(targetConfiguration, response, conn, false, false); + TargetResponse targetResponse = new TargetResponse(targetConfiguration, response, conn, false, false); - try { - targetResponse.start(conn); - } catch (Exception e) { - logger.error(e); - Assert.fail("Unable to start the target response!"); - } + try { + targetResponse.start(conn); + } catch (Exception e) { + logger.error(e); + Assert.fail("Unable to start the target response!"); } }pom.xml (1)
1152-1162: Consider aligning mockito-inline version with mockito.version property.The
mockito-inlinedependency uses a hardcoded version5.2.0(line 1160), whilemockito-coreuses the${mockito.version}property set to5.3.1(line 1598). Using different versions of the same library might lead to compatibility issues.Apply this diff to use the property for consistency:
<dependency> <groupId>org.mockito</groupId> <artifactId>mockito-inline</artifactId> - <version>5.2.0</version> + <version>${mockito.version}</version> <scope>test</scope> </dependency>Before applying this change, verify that mockito-inline 5.3.1 is compatible with the codebase by checking the Mockito release notes.
modules/extensions/src/test/java/org/apache/synapse/mediators/bsf/ScriptMediatorSerializationTest.java (1)
57-63: Ruby-engine guard avoids false negatives on JDK 21The runtime check cleanly avoids failing this test when no Ruby
ScriptEngineis present, which is useful on newer JDKs. If you want clearer test reporting and less console noise, consider using a test-framework skip/assumption mechanism instead ofSystem.out.println+return.modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/ScriptMediator.java (2)
432-445: JS vs non-JS message context split looks consistentRouting JAVA_SCRIPT/GRAAL_JAVA_SCRIPT through
GraalVMJavaScriptMessageContextand everything else throughCommonScriptMessageContextlines up with how JSON payloads and input arguments are now handled for JS. Only minor nit: the Javadoc above still references “Nashorn” even though the JS path now uses the Graal-based context; consider updating it for clarity.
667-672: Nashorn → Graal mapping works but leaves dead Nashorn-specific branchesRewriting
NASHORN_JAVA_SCRIPTtoGRAAL_JAVA_SCRIPThere is a sensible compatibility move for JDK 21, and ensures all “nashornJs” usages are executed on the Graal engine. However, after this reassignment:
- Later checks for
NASHORN_JAVA_SCRIPT(e.g., in helper selection,getScriptEngineSupplier,getNewScriptEngine) become effectively unreachable.oracleNashornFactoryand the helper methods around it no longer influence behavior.Consider either removing the now-dead Nashorn-specific branches and unused helpers, or adding a brief comment explaining why they remain, to avoid confusion for future maintainers.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (52)
modules/commons/pom.xml(1 hunks)modules/commons/src/main/java/org/apache/synapse/commons/datasource/DataSourceFinder.java(1 hunks)modules/commons/src/main/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLBinder.java(1 hunks)modules/commons/src/main/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLMapper.java(1 hunks)modules/commons/src/main/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLRootProvider.java(1 hunks)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLBinderTest.java(1 hunks)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLRootProviderTest.java(1 hunks)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/ObjectFactory.java(1 hunks)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleRootElement.java(1 hunks)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleType.java(1 hunks)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleTypeWithNamespace.java(1 hunks)modules/core/pom.xml(0 hunks)modules/core/src/test/java/org/apache/synapse/aspects/flow/statistics/util/StatisticDataCollectionHelperTest.java(3 hunks)modules/core/src/test/java/org/apache/synapse/config/xml/SynapseXMLConfigurationSerializerTest.java(2 hunks)modules/core/src/test/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiverTest.java(1 hunks)modules/core/src/test/java/org/apache/synapse/endpoints/DynamicLoadBalanceEndpointTest.java(2 hunks)modules/core/src/test/java/org/apache/synapse/endpoints/HttpEndpointTest.java(1 hunks)modules/core/src/test/java/org/apache/synapse/endpoints/RecipientListEndpointTest.java(2 hunks)modules/core/src/test/java/org/apache/synapse/endpoints/auth/oauth/OAuthClientTest.java(2 hunks)modules/core/src/test/java/org/apache/synapse/endpoints/resolvers/ResolverFactoryTest.java(4 hunks)modules/core/src/test/java/org/apache/synapse/mediators/bean/Enterprise/EJBMediatorTest.java(3 hunks)modules/core/src/test/java/org/apache/synapse/message/store/RabbitMQStoreTest.java(1 hunks)modules/core/src/test/java/org/apache/synapse/util/ResourceMapTest.java(4 hunks)modules/coverage-report/pom.xml(1 hunks)modules/distribution/src/main/bin/ciphertool.sh(1 hunks)modules/distribution/src/main/bin/synapse-config-migrator.sh(1 hunks)modules/distribution/src/main/bin/synapse.sh(1 hunks)modules/extensions/pom.xml(0 hunks)modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/NashornJavaScriptMessageContext.java(0 hunks)modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/ScriptMediator.java(3 hunks)modules/extensions/src/test/java/org/apache/synapse/mediators/bsf/ScriptMediatorSerializationTest.java(2 hunks)modules/integration/pom.xml(2 hunks)modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java(1 hunks)modules/samples/src/main/scripts/axis2Server/axis2server.sh(2 hunks)modules/tasks/pom.xml(0 hunks)modules/tasks/src/test/java/org/apache/synapse/task/service/TaskSchedulerTest.java(1 hunks)modules/transports/core/nhttp/pom.xml(1 hunks)modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/nhttp/NHttpTransportListenerTest.java(0 hunks)modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/DeliveryAgentTest.java(2 hunks)modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/PassThroughHttpSenderTest.java(5 hunks)modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/RequestResponseTest.java(0 hunks)modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/TargetHandlerTest.java(4 hunks)modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/TargetResponseTest.java(4 hunks)modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/connections/HostConnectionsTest.java(2 hunks)modules/transports/core/nhttp/src/test/resources/log4j.properties(1 hunks)modules/transports/optional/fix/pom.xml(0 hunks)modules/transports/optional/fix/src/main/java/org/apache/synapse/transport/fix/FIXTransportSender.java(1 hunks)modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXIncomingMessageHandlerTest.java(3 hunks)modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXOutgoingMessageHandlerTest.java(3 hunks)modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXTransportListenerTest.java(2 hunks)modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXTransportSenderTest.java(3 hunks)pom.xml(6 hunks)
💤 Files with no reviewable changes (7)
- modules/transports/optional/fix/pom.xml
- modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/NashornJavaScriptMessageContext.java
- modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/RequestResponseTest.java
- modules/tasks/pom.xml
- modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/nhttp/NHttpTransportListenerTest.java
- modules/extensions/pom.xml
- modules/core/pom.xml
🧰 Additional context used
🧬 Code graph analysis (18)
modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLBinderTest.java (2)
modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleType.java (1)
XmlType(21-25)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleTypeWithNamespace.java (1)
XmlType(21-25)
modules/core/src/test/java/org/apache/synapse/aspects/flow/statistics/util/StatisticDataCollectionHelperTest.java (3)
modules/core/src/main/java/org/apache/synapse/aspects/flow/statistics/collectors/RuntimeStatisticCollector.java (1)
RuntimeStatisticCollector(36-429)modules/core/src/main/java/org/apache/synapse/aspects/flow/statistics/util/StatisticsConstants.java (1)
StatisticsConstants(26-202)modules/core/src/main/java/org/apache/synapse/aspects/flow/statistics/util/StatisticDataCollectionHelper.java (1)
StatisticDataCollectionHelper(32-162)
modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXIncomingMessageHandlerTest.java (2)
modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXOutgoingMessageHandlerTest.java (1)
RunWith(41-70)modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXTransportListenerTest.java (1)
RunWith(43-98)
modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLRootProviderTest.java (4)
modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleRootElement.java (1)
XmlRootElement(26-34)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLBinderTest.java (1)
XmlType(58-60)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleType.java (1)
XmlType(21-25)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleTypeWithNamespace.java (1)
XmlType(21-25)
modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXTransportListenerTest.java (2)
modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXIncomingMessageHandlerTest.java (1)
RunWith(45-125)modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXOutgoingMessageHandlerTest.java (1)
RunWith(41-70)
modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXOutgoingMessageHandlerTest.java (2)
modules/core/src/test/java/org/apache/synapse/aspects/flow/statistics/util/StatisticDataCollectionHelperTest.java (1)
RunWith(46-167)modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXIncomingMessageHandlerTest.java (1)
RunWith(45-125)
modules/core/src/test/java/org/apache/synapse/endpoints/resolvers/ResolverFactoryTest.java (1)
modules/commons/src/main/java/org/apache/synapse/commons/resolvers/ResolverFactory.java (1)
ResolverFactory(29-139)
modules/core/src/test/java/org/apache/synapse/mediators/bean/Enterprise/EJBMediatorTest.java (3)
modules/core/src/test/java/org/apache/synapse/aspects/flow/statistics/util/StatisticDataCollectionHelperTest.java (1)
RunWith(46-167)modules/core/src/test/java/org/apache/synapse/endpoints/auth/oauth/OAuthClientTest.java (1)
RunWith(55-106)modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXOutgoingMessageHandlerTest.java (1)
RunWith(41-70)
modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXTransportSenderTest.java (2)
modules/core/src/test/java/org/apache/synapse/aspects/flow/statistics/util/StatisticDataCollectionHelperTest.java (1)
RunWith(46-167)modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXOutgoingMessageHandlerTest.java (1)
RunWith(41-70)
modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/TargetHandlerTest.java (1)
modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetContext.java (1)
TargetContext(34-258)
modules/commons/src/main/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLBinder.java (4)
modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleRootElement.java (1)
XmlRootElement(26-34)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLBinderTest.java (1)
XmlType(58-60)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleType.java (1)
XmlType(21-25)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleTypeWithNamespace.java (1)
XmlType(21-25)
modules/core/src/test/java/org/apache/synapse/config/xml/SynapseXMLConfigurationSerializerTest.java (1)
modules/core/src/main/java/org/apache/synapse/config/Entry.java (1)
Entry(35-251)
modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/PassThroughHttpSenderTest.java (1)
modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/PassThroughConfiguration.java (1)
PassThroughConfiguration(38-411)
modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleType.java (2)
modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLBinderTest.java (1)
XmlType(58-60)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleTypeWithNamespace.java (1)
XmlType(21-25)
modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/TargetResponseTest.java (1)
modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetContext.java (1)
TargetContext(34-258)
modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleTypeWithNamespace.java (2)
modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLBinderTest.java (1)
XmlType(58-60)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleType.java (1)
XmlType(21-25)
modules/core/src/test/java/org/apache/synapse/endpoints/auth/oauth/OAuthClientTest.java (1)
modules/core/src/main/java/org/apache/synapse/endpoints/auth/oauth/OAuthClient.java (1)
OAuthClient(98-464)
modules/commons/src/main/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLRootProvider.java (5)
modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/ObjectFactory.java (1)
XmlRegistry(23-38)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleRootElement.java (1)
XmlRootElement(26-34)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLBinderTest.java (1)
XmlType(58-60)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleType.java (1)
XmlType(21-25)modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleTypeWithNamespace.java (1)
XmlType(21-25)
🔇 Additional comments (60)
modules/transports/core/nhttp/src/test/resources/log4j.properties (1)
1-8: Verify Log4j v1 compatibility with JDK 21 modernization effort.This test resource uses Log4j v1 (org.apache.log4j.*) configuration, which reached end-of-life in 2015. Given that this PR is a broad modernization effort to support JDK 21, please verify:
- Whether the project intends to continue using Log4j v1 or has plans to migrate to Log4j v2
- That Log4j v1 is explicitly tested and compatible with JDK 21
- How this aligns with other test logging configurations across the codebase
The configuration itself is structurally sound—it properly sets the root logger to INFO with a ConsoleAppender and includes a reasonable timestamp-based pattern layout suitable for tests.
modules/core/src/test/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiverTest.java (1)
88-88: LGTM! Clean migration from PowerMockito to Mockito.The replacement of
PowerMockito.mockwithMockito.mockis correct for this use case. SinceAxis2SynapseEnvironmentis instantiated directly elsewhere in the test (line 102) and only instance methods are being stubbed, standard Mockito is sufficient and no PowerMockito features are needed.modules/core/src/test/java/org/apache/synapse/endpoints/DynamicLoadBalanceEndpointTest.java (2)
76-77: LGTM! Clean migration from PowerMockito to Mockito.The migration from
PowerMockito.mock()toMockito.mock()is correct and aligns with the PR objective of supporting JDK 21 compilation by removing PowerMock dependencies.
103-103: LGTM! Consistent migration approach.The migration to
Mockito.mock()is correctly applied, maintaining consistency with the other mock creation in this test class.modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXTransportListenerTest.java (3)
37-39: LGTM! Standard Mockito imports added.The imports are correctly updated to support the migration from PowerMockito to Mockito.
43-43: LGTM! Correct test runner for Mockito.The migration from
PowerMockRunnertoMockitoJUnitRunneris appropriate for this test class.
92-92: LGTM! Correct migration to Mockito.The change from
PowerMockito.whentoMockito.whenis correct for mocking the instance method.modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/connections/HostConnectionsTest.java (2)
33-33: LGTM!The addition of the
Fieldimport is necessary for the reflection-based approach that replaces PowerMockito's field injection.
62-64: Field exists and reflection access is correct.Verification confirms that the
freeConnectionsfield exists as a declared private field in theHostConnectionsclass (line 69). The migration from PowerMockito to standard Java reflection is implemented correctly, and the field name in the reflection code matches the actual declaration.modules/distribution/src/main/bin/synapse.sh (1)
120-128: LGTM: Endorsed JAR classpath handling is correctly implemented.The transition from
-Djava.endorsed.dirsto runtime classpath augmentation is well-structured, with proper directory existence checks and consistent variable naming. This aligns with Java 9+ requirements.modules/distribution/src/main/bin/synapse-config-migrator.sh (1)
107-115: LGTM: Endorsed JAR classpath handling mirrors best practices fromsynapse.sh.Consistent implementation with proper checks and clear deprecation comments.
modules/samples/src/main/scripts/axis2Server/axis2server.sh (2)
116-124: LGTM: Endorsed JAR classpath handling is correct and consistent.Proper implementation with clear deprecation context.
169-169: No verification needed—arguments are already fully supported.The
SampleAxis2Serverclass correctly accepts-repoand-confarguments. TheSampleAxis2ServerManager.start()method implements robust argument parsing usingCommandLineOptionParserwith explicit validation that only "repo" and "conf" options are accepted. Existing unit tests already invokeSampleAxis2Server.main()with these exact arguments and pass successfully, confirming the implementation works. No breaking changes will occur.modules/core/src/test/java/org/apache/synapse/message/store/RabbitMQStoreTest.java (1)
21-47: PowerMock removal is appropriate; tests run fine under the default JUnit runnerThis class no longer uses any PowerMock APIs or features, so removing
PowerMockRunner/@PrepareForTestand relying on the standard JUnit runner is safe and reduces complexity. The tests only use reflection and regular JUnit assertions, so behavior should remain unchanged. Repository-wide verification confirms no remaining PowerMock usages exist.modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXIncomingMessageHandlerTest.java (2)
32-33: LGTM! Migration setup is correct.The migration from PowerMockRunner to MockitoJUnitRunner is properly configured with the necessary imports. This aligns with the PR objective to modernize the test framework.
Also applies to: 45-45
76-79: LGTM! Mockito stubbing correctly replaces PowerMockito.The migration from
PowerMockito.whentoMockito.whenis correct and follows standard Mockito patterns for method stubbing.modules/core/src/test/java/org/apache/synapse/config/xml/SynapseXMLConfigurationSerializerTest.java (2)
40-40: LGTM! Import migration is correct.The migration from PowerMockito to Mockito is appropriate and correctly implemented.
177-180: Confirm the test passes with current mock setup and verify ifgetType()stubbing is needed.Based on verification of the
EntrySerializercode and mock behavior, the review comment's analysis is accurate. When callingsetIntegerValue(50)on a Mockito mock,getIntegerValue()still returns 0, not 50—Mockito just doesn't match the getter and setter.Since
EntrySerializer.serializeEntry()explicitly callsentry.getType()and checks if it equalsEntry.URL_SRC(value 2), the mock will return 0 (the default for int methods) instead. The test currently passes only because it verifies only the key attribute, which is always serialized regardless of type.The suggestion to add
Mockito.doReturn(Entry.URL_SRC).when(entry).getType();is valid and improves test correctness. However, verify whether this is truly necessary by checking if the test intentionally verifies only partial serialization or if fuller verification is expected.modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXTransportSenderTest.java (3)
32-33: LGTM!Clean migration to standard Mockito imports.
60-60: LGTM!Appropriate test runner for Mockito-based testing.
109-114: Spy test is fragile and relies on stubbing to avoid NPEs; verify and improve with proper initialization.The spy is created without calling
init(), leavingcfgCtx(inherited fromAbstractTransportSender) uninitialized. While the test currently passes becausesendUsingEPRis stubbed (preventing its body at line 277 from executing), this approach is fragile:
- Line 286 in
sendUsingEPRaccessescfgCtx.getAxisConfiguration(), which would throw NPE if the method body executed- The test depends entirely on stubbing to work; any refactor removing or delaying the stub would cause failures
- Similar tests in the codebase (e.g.,
FIXOutgoingMessageHandlerTest.java) use@Mockand@InjectMocksfor proper dependency injectionConsider initializing the spy with required dependencies or using the
@Mock/@InjectMockspattern to avoid fragility.modules/core/src/test/java/org/apache/synapse/util/ResourceMapTest.java (2)
28-32: Mockito import migration looks correctUsing
org.mockito.Mockitotogether with staticArgumentMatchers.any/anyStringmatches the usages below and removes the PowerMockito dependency without changing behavior.Please ensure the project’s Mockito version matches this API (e.g., run a quick compile on the test sources).
65-65:Mockito.when(...)stubs correctly replace PowerMockitoThe instance-method stubs for
synapseConfiguration.getEntry(anyString())andsynapsePath.getExpression()are straightforward Mockito equivalents of the old PowerMockito calls, and they keep the tests focused onResourceMapbehavior rather than exact key values.If you want slightly stricter tests later, you could replace
anyString()witheq(helloKey)to assert thatResourceMapuses the expected registry key, but this is not required for correctness.Also applies to: 76-78, 88-88
modules/transports/optional/fix/src/test/java/org/apache/synapse/transport/fix/FIXOutgoingMessageHandlerTest.java (2)
27-29: Mockito migration wiring looks correctUsing
@RunWith(MockitoJUnitRunner.class)together with@Mockand@InjectMocks, plusMockedStaticfor static calls, is a good replacement for the previous PowerMockito-based setup and is consistent with other updated tests in this codebase. No functional issues spotted in this part.Also applies to: 41-50
59-67: Add explicit verification to theSession.sendToTargetmock invocationThe static stub signature correctly matches production usage—
FIXOutgoingMessageHandler.sendMessagedelegates to its privatesendToTargetmethod, which callsSession.sendToTarget(message, sessionID)(line 138). This matches your stubbed overload.However, the test currently verifies only the absence of exceptions. Add an explicit mock verification to ensure the handler properly invokes the QuickFIX session:
try (MockedStatic<Session> mockedSession = Mockito.mockStatic(Session.class)) { mockedSession.when(() -> Session.sendToTarget(any(Message.class), any(SessionID.class))) .thenReturn(true); SessionID id = new SessionID(new BeginString("FIX.4.1"), new SenderCompID("SYNAPSE"), new TargetCompID("BANZAI"), "FIX.4.1:SYNAPSE->BANZAI"); spy.sendMessage(message, id, SESSION_ID, SEQ_NUM, msgCtx, "fix://sample"); + mockedSession.verify(() -> Session.sendToTarget(message, id)); }modules/core/src/test/java/org/apache/synapse/endpoints/HttpEndpointTest.java (1)
162-162: LGTM! PowerMock to Mockito migration applied correctly.The change from
PowerMockito.mocktoMockito.mockis correct and aligns with the PR's objective to migrate away from PowerMock.modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/DeliveryAgentTest.java (2)
31-31: LGTM! Import updated for Mockito migration.Correctly replaced PowerMockito import with standard Mockito static import.
49-51: LGTM! Mock creation updated to use Mockito.The migration from
PowerMockito.mock(...)tomock(...)is correct and consistent with the broader Mockito migration.modules/core/src/test/java/org/apache/synapse/endpoints/RecipientListEndpointTest.java (1)
185-185: LGTM! Mockito migration applied correctly.The migration from
PowerMockito.mocktoMockito.mockis correct.modules/coverage-report/pom.xml (1)
95-115: LGTM! JaCoCo reporting consolidated effectively.The refactoring simplifies coverage collection by:
- Pointing directly to module
targetdirectories instead ofcoverage-reportssubdirectories- Using a single
jacoco.execfile per module instead of multiplejacoco-unit*.execfilesThis aligns with the PR's JaCoCo upgrade to 0.8.12 and improves maintainability.
modules/core/src/test/java/org/apache/synapse/aspects/flow/statistics/util/StatisticDataCollectionHelperTest.java (4)
31-33: LGTM! Correct imports for Mockito static mocking.Added the necessary imports for
MockedStaticwhich replaces PowerMock's static mocking capabilities.
46-46: LGTM! Test runner updated for Mockito.The switch to
MockitoJUnitRunneris correct and consistent with the PowerMock to Mockito migration.
136-148: LGTM! Static method mocking implemented correctly.The use of try-with-resources with
MockedStaticis the proper pattern for mocking static methods in Mockito. This ensures the static mock is automatically cleaned up after the test.
156-165: LGTM! Static mocking pattern applied consistently.The static mocking of
RuntimeStatisticCollectormethods follows the correct Mockito pattern with proper scoping via try-with-resources.modules/commons/src/main/java/org/apache/synapse/commons/datasource/DataSourceFinder.java (1)
73-84: LGTM! JNDI dereferencing implemented correctly.The automatic dereferencing of
javax.naming.Referenceobjects usingNamingManager.getObjectInstanceis the correct approach for JNDI lookups that may return references instead of direct objects.modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/PassThroughHttpSenderTest.java (3)
45-49: LGTM! Test infrastructure updated for Mockito.The migration includes:
- Correct static imports for Mockito methods
- Addition of
PassThroughTestUtilsfor configuration setup- Proper initialization of
passThroughConfigurationAlso applies to: 78-78
111-113: LGTM! Spy creation migrated to Mockito.The change from
PowerMockito.spytoMockito.spyis correct, and the mock configuration properly useswhen(...).thenReturn(...).
135-148: LGTM! Mock and spy usage updated consistently.All PowerMock calls have been correctly replaced with their Mockito equivalents while preserving test behavior.
modules/core/src/test/java/org/apache/synapse/endpoints/resolvers/ResolverFactoryTest.java (4)
26-33: LGTM! JUnit 3 to JUnit 4 migration completed correctly.The changes properly modernize the test:
- Removed
extends TestCasedependency- Switched to JUnit 4 static assertion imports
- Test structure now follows JUnit 4 conventions
35-50: LGTM! Test assertions enhanced.The migration adds explicit
@Testannotations and improves assertions by verifying both the resolver type and its resolution behavior.
52-68: LGTM! Consistent test improvements applied.Additional tests properly migrated with enhanced assertions that verify resolver type and default resolution behavior.
76-83: LGTM! SystemResolver test updated.The test correctly migrates to JUnit 4 and maintains type verification for
SystemResolver.modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleRootElement.java (1)
20-22: JAXB annotation namespace migration looks goodImports cleanly switch to
jakarta.xml.bind.annotation.*with no other changes; the DTO and its annotations remain semantically identical.Please ensure the test module’s POM is wired to
jakarta.xml.bind-apiso these annotations resolve under JDK 21.modules/commons/src/main/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLBinder.java (1)
24-29: Mechanical JAXB → Jakarta import migration; binder behavior unchangedThe move from
javax.xml.bind.*tojakarta.xml.bind.*in this binder is straightforward, and the rest of the logic (bindability checks, marshal/unmarshal, array handling) remains untouched.Please ensure the runtime includes a Jakarta JAXB implementation compatible with
jakarta.xml.bind-apifor these types.modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/ObjectFactory.java (1)
18-20: ObjectFactory JAXB imports correctly migrated to JakartaUpdating
JAXBElement,XmlElementDecl, andXmlRegistryto thejakarta.xml.bindnamespace is consistent with the rest of the Jakarta migration; the factory methods and QNames remain the same.Please confirm the corresponding tests still pass with the Jakarta JAXB runtime under JDK 21.
modules/commons/src/main/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLRootProvider.java (1)
21-28: JAXB javax→jakarta namespace switch looks correctImports now consistently use
jakarta.xml.bind.*andjakarta.xml.bind.annotation.*while the rest of the class logic is unchanged, so behaviour is preserved assuming a Jakarta JAXB runtime is present on the classpath.modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLRootProviderTest.java (1)
21-25: Test imports aligned with Jakarta JAXBUsing
jakarta.xml.bind.*and JAXB annotations here matches the main-class migration and keeps the tests semantically identical.modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/JsonXMLBinderTest.java (1)
26-30: Jakarta JAXB usage in tests is consistentThe switch to
jakarta.xml.bindAPIs and@XmlTypehere matches the main JAXB migration; all calls toJAXBContext,MarshallerandUnmarshallerremain valid.modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleType.java (1)
18-19: SampleType annotations migrated cleanly to Jakarta
@XmlElementand@XmlTypenow come fromjakarta.xml.bind.annotation, which is consistent with the rest of the JAXB migration.modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/TargetHandlerTest.java (1)
38-45: Mockito static-mocking imports are correct
MockedStaticand the static imports fromMockitoare exactly what you need for the new static-mocking pattern used below.modules/commons/src/test/java/org/apache/synapse/commons/staxon/core/json/jaxb/sample/SampleTypeWithNamespace.java (1)
18-19: Namespace-aware sample type updated to Jakarta JAXBThe move to
jakarta.xml.bind.annotationfor@XmlElementand@XmlTypekeeps the existing namespace configuration (urn:staxon:jaxb:test) unaffected.modules/integration/pom.xml (1)
295-295: Updated Surefire JVM args are JDK‑21 friendlySwitching from
MaxPermSizeto Metaspace options in<argLine>aligns with post‑PermGen JVMs and is compatible with Java 21; no issues from the POM side.modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/passthru/TargetResponseTest.java (3)
99-122: LGTM! Proper Mockito migration.The static mocking is correctly implemented using try-with-resources and the mock is properly stubbed to return a TargetContext instance.
130-163: LGTM! Static mocking properly implemented.The migration to Mockito is correct with proper use of try-with-resources and static method stubbing.
172-203: LGTM! Excellent Mockito migration with constructor mocking.The test demonstrates proper use of both static and constructor mocking. The verification of
TargetContext.updateState()ensures the expected state transition occurs.pom.xml (3)
221-222: LGTM! Java 21 compilation target set correctly.The compiler plugin is properly configured for JDK 21, aligning with the PR objectives.
1475-1475: LGTM! Build tooling versions updated appropriately.The updates to JaCoCo (0.8.12), Maven WAR Plugin (3.5.0), and Glassfish Jersey (2.41) align with JDK 21 requirements and are consistent across the POM.
Also applies to: 1482-1482, 1606-1607, 1638-1638
1355-1357: Version compatibility confirmed—no action required.jaxb-impl 4.0.6 is compatible with jakarta.xml.bind-api 4.0.4, as minor/patch bumps within the 4.0.x releases are intended to work together. The version difference noted is not a concern.
modules/extensions/src/test/java/org/apache/synapse/mediators/bsf/ScriptMediatorSerializationTest.java (1)
24-24: Import addition is appropriate
ScriptEngineManageris used in the Ruby engine availability guard below; the import is correct and scoped to its only usage.modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/ScriptMediator.java (1)
470-498: JSON payload handling correctly prefers Graal path for JS languagesThe updated condition in
processJSONPayloadensures that JAVA_SCRIPT and GRAAL_JAVA_SCRIPT use theGraalVMJavaScriptMessageContext’s JSON serializer, while non-JS languages continue to use the genericjsEngine-based parsing path. This keeps JSON handling consistent with the new JS message context and thepreprocessJSONInputArgumentlogic.
| /** | ||
| * Create a mock SynapseEnvironment object | ||
| * | ||
| * @return Axis2SynapseEnvironment instance | ||
| * @throws AxisFault on creating/mocking object | ||
| */ | ||
| /** | ||
| * Create a mock SynapseEnvironment object | ||
| * | ||
| * @return Axis2SynapseEnvironment instance | ||
| * @throws AxisFault on creating/mocking object | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove duplicate JavaDoc comment.
The same JavaDoc block appears twice (lines 172-177 and 178-183). Remove the first occurrence to eliminate duplication.
Apply this diff:
- /**
- * Create a mock SynapseEnvironment object
- *
- * @return Axis2SynapseEnvironment instance
- * @throws AxisFault on creating/mocking object
- */
/**
* Create a mock SynapseEnvironment object
*
* @return Axis2SynapseEnvironment instance
* @throws AxisFault on creating/mocking object
*/📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /** | |
| * Create a mock SynapseEnvironment object | |
| * | |
| * @return Axis2SynapseEnvironment instance | |
| * @throws AxisFault on creating/mocking object | |
| */ | |
| /** | |
| * Create a mock SynapseEnvironment object | |
| * | |
| * @return Axis2SynapseEnvironment instance | |
| * @throws AxisFault on creating/mocking object | |
| */ | |
| /** | |
| * Create a mock SynapseEnvironment object | |
| * | |
| * @return Axis2SynapseEnvironment instance | |
| * @throws AxisFault on creating/mocking object | |
| */ |
🤖 Prompt for AI Agents
modules/core/src/test/java/org/apache/synapse/endpoints/RecipientListEndpointTest.java
around lines 172-183: remove the first duplicate JavaDoc block (lines 172-177)
so only a single JavaDoc remains immediately above the method; delete the
redundant comment lines and leave the second/remaining JavaDoc intact.
| SYNAPSE_HOME=`cygpath --absolute --windows "$SYNAPSE_HOME"` | ||
| AXIS2_HOME=`cygpath --absolute --windows "$SYNAPSE_HOME"` | ||
| CLASSPATH=`cygpath --path --windows "$CLASSPATH"` | ||
| JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Remove dead code: unused JAVA_ENDORSED_DIRS Cygwin conversion.
The conversion of JAVA_ENDORSED_DIRS on line 105 is no longer needed since endorsed directories are now handled via classpath augmentation (lines 107–115) rather than the JVM option.
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
- JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
fi📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"` | |
| CLASSPATH=`cygpath --path --windows "$CLASSPATH"` | |
| fi |
🤖 Prompt for AI Agents
In modules/distribution/src/main/bin/synapse-config-migrator.sh around line 105,
remove the now-dead conversion of JAVA_ENDORSED_DIRS via cygpath since endorsed
dirs are handled through classpath augmentation (lines 107–115); delete the line
that assigns JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
and ensure no other references to that converted variable remain, leaving
classpath-based handling intact.
| SYNAPSE_HOME=`cygpath --absolute --windows "$SYNAPSE_HOME"` | ||
| AXIS2_HOME=`cygpath --absolute --windows "$SYNAPSE_HOME"` | ||
| CLASSPATH=`cygpath --path --windows "$CLASSPATH"` | ||
| JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Remove dead code: unused JAVA_ENDORSED_DIRS Cygwin conversion.
Since endorsed directories are now handled via classpath augmentation (lines 120–128) rather than the -Djava.endorsed.dirs JVM option, the conversion of JAVA_ENDORSED_DIRS on line 118 is no longer needed and should be removed.
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
- JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
fi📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"` | |
| CLASSPATH=`cygpath --path --windows "$CLASSPATH"` | |
| fi |
🤖 Prompt for AI Agents
In modules/distribution/src/main/bin/synapse.sh around line 118, remove the
now-unused Cygwin conversion of JAVA_ENDORSED_DIRS (the `cygpath --path
--windows "$JAVA_ENDORSED_DIRS"` invocation) because endorsed dirs are handled
via classpath augmentation later (lines 120–128); delete that line and any
direct references to JAVA_ENDORSED_DIRS nearby if they become unused, leaving
classpath-based handling intact and ensuring the script still passes
shellcheck/sanity checks after removal.
| JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"` | ||
| AXIS2_HOME=`cygpath --absolute --windows "$AXIS2_HOME"` | ||
| CLASSPATH=`cygpath --path --windows "$CLASSPATH"` | ||
| JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Remove dead code: unused JAVA_ENDORSED_DIRS Cygwin conversion.
The conversion of JAVA_ENDORSED_DIRS on line 113 is no longer needed since endorsed directories are now handled via classpath augmentation (lines 116–124) rather than the JVM option.
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
- JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
fi📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"` | |
| CLASSPATH=`cygpath --path --windows "$CLASSPATH"` | |
| fi |
🤖 Prompt for AI Agents
In modules/samples/src/main/scripts/axis2Server/axis2server.sh around line 113,
remove the dead Cygwin conversion of JAVA_ENDORSED_DIRS (`cygpath --path
--windows "$JAVA_ENDORSED_DIRS"`) because endorsed dirs are now handled via
classpath augmentation (lines 116–124); delete that line and ensure no other
remaining references to JAVA_ENDORSED_DIRS rely on the converted value (if any,
update them to use the classpath augmentation logic instead).
Related to wso2/product-micro-integrator#4494
As part of the effort, the following changes have been made.
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.