Skip to content

Modernize org.eclipse.equinox.region.tests: Remove AspectJ, convert to JUnit 5#126

Closed
Copilot wants to merge 4 commits into
masterfrom
copilot/modernize-region-tests-junit5
Closed

Modernize org.eclipse.equinox.region.tests: Remove AspectJ, convert to JUnit 5#126
Copilot wants to merge 4 commits into
masterfrom
copilot/modernize-region-tests-junit5

Conversation

Copy link
Copy Markdown

Copilot AI commented Nov 4, 2025

The region tests were disabled since 2015 due to AspectJ dependency from embedded Virgo test stubs. This modernizes the test suite to JUnit 5 and replaces Virgo stubs with Mockito.

Changes

Test Framework Migration

  • Converted all tests from JUnit 4 to JUnit 5 (annotations, assertions, test suites)
  • Updated test suite from @RunWith(Suite.class) to @Suite with @SelectClasses

Virgo Stub Replacement

  • Created MockBundleBuilder helper to replace StubBundle/StubBundleContext
  • Replaced all Virgo test stubs with Mockito mocks:
    • StubBundleMockBundleBuilder.createMockBundle()
    • StubBundleContextmock(BundleContext.class)
    • StubServiceReferencemock(ServiceReference.class)

Build Configuration

  • Removed AspectJ imports from MANIFEST.MF, added org.junit.jupiter.api and org.junit.platform.suite.api
  • Removed stubs/org.eclipse.virgo.teststubs.osgi.jar from classpath and build.properties
  • Created pom.xml for Maven/Tycho build
  • Re-enabled module in root pom.xml

Example

Before (using Virgo stubs):

StubBundle stubSystemBundle = new StubBundle(0L, "osgi.framework", new Version("0"), "loc");
StubBundleContext stubBundleContext = new StubBundleContext();
stubBundleContext.addInstalledBundle(stubSystemBundle);

After (using Mockito):

Bundle stubSystemBundle = MockBundleBuilder.createMockBundle(0L, "osgi.framework", new Version("0"), "loc");
BundleContext stubBundleContext = mock(BundleContext.class);
when(stubBundleContext.getBundle(0L)).thenReturn(stubSystemBundle);

Closes bug 470000

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • repo.eclipse.org
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.11/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.11/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.11 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.11/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/equinox/equinox org.codehaus.plexus.classworlds.launcher.Launcher clean install -DskipTests=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Modernize org.eclipse.equinox.region.tests

The region tests are currently disabled due to

removed until the dependency on aspectj is removed. see bug [470000}(https://bugs.eclipse.org/bugs/show_bug.cgi?id=470000)

I have looked into them and found the follwoing issues:

  1. They still use JUnit 4, we should convert them to JUnit5
  2. org.aspectj is not what we want there are some PRs with more context here Build o.e.equinox.compendium.tests and o.e.equinox.region.tests eclipse-equinox/equinox#29
  3. I atempted to remove that here Enable region tests eclipse-equinox/equinox#839 and found that it is needed for the embedded virgo tests to mock some aspects of the OSGi framework

To overcome this limitations I see two options by we need to analyze what likley fits bet due to the nature of the testes:


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits November 4, 2025 09:11
…th Mockito

Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Copilot AI changed the title [WIP] Update org.eclipse.equinox.region tests for JUnit 5 Modernize org.eclipse.equinox.region.tests: Remove AspectJ, convert to JUnit 5 Nov 4, 2025
Copilot AI requested a review from laeubi November 4, 2025 09:20
@laeubi laeubi closed this Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants