Skip to content

Commit

Permalink
Remove abstract OSGiTest class and dependency to CoreTest
Browse files Browse the repository at this point in the history
This removes all dependencies to the to-be-removed JUnit 3-specific
CoreTest class. To this end, the OSGiTest class, which only contains
utility methods, is removed and the remaining utility fields and methods
moved to the existing OSGiTestActivator class.
  • Loading branch information
HeikoKlare committed Jan 12, 2024
1 parent 03533f1 commit 824884d
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 70 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,36 @@
*******************************************************************************/
package org.eclipse.osgi.tests;

import org.eclipse.core.tests.session.ConfigurationSessionTestSuite;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;

public class OSGiTestsActivator {
private OSGiTestsActivator() {
}
public static final String PI_OSGI_TESTS = "org.eclipse.osgi.tests";

public static final String TEST_FILES_ROOT = "test_files/";

private OSGiTestsActivator() {
}

public static Bundle getBundle() {
return FrameworkUtil.getBundle(OSGiTestsActivator.class);
}

public static BundleContext getContext() {
return getBundle().getBundleContext();
}

public static void addRequiredOSGiTestsBundles(ConfigurationSessionTestSuite suite) {
suite.addMinimalBundleSet();
suite.addThisBundle();
suite.addBundle(org.osgi.util.function.Function.class);
suite.addBundle(org.osgi.util.measurement.Measurement.class);
suite.addBundle(org.osgi.util.position.Position.class);
suite.addBundle(org.osgi.util.promise.Promise.class);
suite.addBundle(org.osgi.util.xml.XMLParserActivator.class);
suite.addBundle(org.osgi.service.event.Event.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
*******************************************************************************/
package org.eclipse.osgi.tests.appadmin;

import static org.eclipse.osgi.tests.OSGiTest.PI_OSGI_TESTS;
import static org.eclipse.osgi.tests.OSGiTest.addRequiredOSGiTestsBundles;
import static org.eclipse.osgi.tests.OSGiTestsActivator.PI_OSGI_TESTS;
import static org.eclipse.osgi.tests.OSGiTestsActivator.addRequiredOSGiTestsBundles;
import static org.eclipse.osgi.tests.OSGiTestsActivator.getContext;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
*******************************************************************************/
package org.eclipse.osgi.tests.appadmin;

import static org.eclipse.osgi.tests.OSGiTest.PI_OSGI_TESTS;
import static org.eclipse.osgi.tests.OSGiTest.addRequiredOSGiTestsBundles;
import static org.eclipse.osgi.tests.OSGiTestsActivator.PI_OSGI_TESTS;
import static org.eclipse.osgi.tests.OSGiTestsActivator.addRequiredOSGiTestsBundles;
import static org.eclipse.osgi.tests.OSGiTestsActivator.getContext;

import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
*******************************************************************************/
package org.eclipse.osgi.tests.configuration;

import static org.eclipse.osgi.tests.OSGiTest.PI_OSGI_TESTS;
import static org.eclipse.osgi.tests.OSGiTest.addRequiredOSGiTestsBundles;
import static org.eclipse.osgi.tests.OSGiTestsActivator.PI_OSGI_TESTS;
import static org.eclipse.osgi.tests.OSGiTestsActivator.addRequiredOSGiTestsBundles;
import static org.junit.Assert.assertThrows;

import java.io.ByteArrayInputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
*******************************************************************************/
package org.eclipse.osgi.tests.configuration;

import static org.eclipse.osgi.tests.OSGiTest.PI_OSGI_TESTS;
import static org.eclipse.osgi.tests.OSGiTest.addRequiredOSGiTestsBundles;
import static org.eclipse.osgi.tests.OSGiTestsActivator.PI_OSGI_TESTS;
import static org.eclipse.osgi.tests.OSGiTestsActivator.addRequiredOSGiTestsBundles;
import static org.eclipse.osgi.tests.OSGiTestsActivator.getContext;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
*******************************************************************************/
package org.eclipse.osgi.tests.configuration;

import static org.eclipse.osgi.tests.OSGiTest.PI_OSGI_TESTS;
import static org.eclipse.osgi.tests.OSGiTest.addRequiredOSGiTestsBundles;
import static org.eclipse.osgi.tests.OSGiTestsActivator.PI_OSGI_TESTS;
import static org.eclipse.osgi.tests.OSGiTestsActivator.addRequiredOSGiTestsBundles;
import static org.eclipse.osgi.tests.OSGiTestsActivator.getContext;

import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
*******************************************************************************/
package org.eclipse.osgi.tests.configuration;

import static org.eclipse.osgi.tests.OSGiTest.PI_OSGI_TESTS;
import static org.eclipse.osgi.tests.OSGiTest.addRequiredOSGiTestsBundles;
import static org.eclipse.osgi.tests.OSGiTestsActivator.PI_OSGI_TESTS;
import static org.eclipse.osgi.tests.OSGiTestsActivator.addRequiredOSGiTestsBundles;
import static org.eclipse.osgi.tests.OSGiTestsActivator.getContext;

import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.osgi.tests.security;

import static org.eclipse.osgi.tests.OSGiTestsActivator.addRequiredOSGiTestsBundles;

import java.io.File;
import java.io.IOException;
import java.security.cert.Certificate;
Expand All @@ -23,7 +25,6 @@
import org.eclipse.osgi.signedcontent.SignedContent;
import org.eclipse.osgi.signedcontent.SignedContentEntry;
import org.eclipse.osgi.signedcontent.SignerInfo;
import org.eclipse.osgi.tests.OSGiTest;
import org.osgi.framework.Bundle;

public class SignedBundleTest extends BaseSecurityTest {
Expand Down Expand Up @@ -74,7 +75,7 @@ public void runTest() {

public static Test suite() {
ConfigurationSessionTestSuite suite = new ConfigurationSessionTestSuite(BUNDLE_SECURITY_TESTS, "Unit session tests for SignedContent");
OSGiTest.addRequiredOSGiTestsBundles(suite);
addRequiredOSGiTestsBundles(suite);
suite.addTestSuite(SignedBundleTest.class);
return suite;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
*******************************************************************************/
package org.eclipse.osgi.tests.services.datalocation;

import static org.eclipse.osgi.tests.OSGiTest.PI_OSGI_TESTS;
import static org.eclipse.osgi.tests.OSGiTest.addRequiredOSGiTestsBundles;
import static org.eclipse.osgi.tests.OSGiTestsActivator.PI_OSGI_TESTS;
import static org.eclipse.osgi.tests.OSGiTestsActivator.addRequiredOSGiTestsBundles;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
*******************************************************************************/
package org.eclipse.osgi.tests.util;

import static org.eclipse.osgi.tests.OSGiTestsActivator.addRequiredOSGiTestsBundles;

import org.eclipse.core.tests.session.ConfigurationSessionTestSuite;
import org.eclipse.core.tests.session.Setup;
import org.eclipse.core.tests.session.SetupManager.SetupException;
import org.eclipse.osgi.tests.OSGiTest;

public class TextProcessorSessionTest extends ConfigurationSessionTestSuite {
private String lang = null;
Expand All @@ -30,7 +31,7 @@ public class TextProcessorSessionTest extends ConfigurationSessionTestSuite {
public TextProcessorSessionTest(String pluginId, Class clazz, String language) {
super(pluginId, clazz);
lang = language;
OSGiTest.addRequiredOSGiTestsBundles(this);
addRequiredOSGiTestsBundles(this);
}

/* (non-Javadoc)
Expand Down

0 comments on commit 824884d

Please sign in to comment.