Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2019-01-23 06:44:37 -0500
committerAlexander Kurtakov2019-01-23 10:27:30 -0500
commit14297cdf8c5f9e3a78193c2911770bb55623d900 (patch)
treec4fb10667fdcf3f28a3d6fc144fda2a39dfbc69f /bundles/org.eclipse.equinox.p2.tests.ui
parent01c280d99f64fb7c12c2283ab84e9ca655f11940 (diff)
downloadrt.equinox.p2-14297cdf8c5f9e3a78193c2911770bb55623d900.tar.gz
rt.equinox.p2-14297cdf8c5f9e3a78193c2911770bb55623d900.tar.xz
rt.equinox.p2-14297cdf8c5f9e3a78193c2911770bb55623d900.zip
Make use of the generified IProvisioningAgent.getService in tests.
Change-Id: I1dbd17868e0bfb6d343cdf91153a7a7554ad0416 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests.ui')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java69
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/TranslationSupportTests.java47
7 files changed, 115 insertions, 80 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF
index 504d3e134..a6807dbbe 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.tests.ui
-Bundle-Version: 1.2.200.qualifier
+Bundle-Version: 1.2.300.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.100",
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml b/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml
index b4532aec4..29c913d95 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml
@@ -21,7 +21,7 @@
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.tests.ui</artifactId>
- <version>1.2.200-SNAPSHOT</version>
+ <version>1.2.300-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java
index 6ab91e12c..fbdbd5fa7 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java
@@ -43,7 +43,8 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
- ServiceTracker<P2ImportExport, P2ImportExport> tracker = new ServiceTracker<>(TestActivator.getContext(), P2ImportExport.class, null);
+ ServiceTracker<P2ImportExport, P2ImportExport> tracker = new ServiceTracker<>(TestActivator.getContext(),
+ P2ImportExport.class, null);
tracker.open();
importexportService = tracker.getService();
assertNotNull("Fail to get ImportExport service", importexportService);
@@ -54,31 +55,34 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
public void tearDown() throws Exception {
super.tearDown();
importexportService = null;
- IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager repoMan = getAgent().getService(IMetadataRepositoryManager.class);
URI[] urls = repoMan.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
for (int i = 0; i < urls.length; i++) {
repoMan.removeRepository(urls[i]);
}
}
- public void testExportFeaturesFromRemoteRepository() throws URISyntaxException, IOException, ProvisionException, OperationCanceledException {
+ public void testExportFeaturesFromRemoteRepository()
+ throws URISyntaxException, IOException, ProvisionException, OperationCanceledException {
File testFile = File.createTempFile("test", "p2f");
URI uri = getTestRepository();
try {
- IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager metaManager = getAgent().getService(IMetadataRepositoryManager.class);
IMetadataRepository repo = metaManager.loadRepository(uri, null);
assertNotNull("Fail to load remote repo", repo);
IInstallableUnit iu = AbstractProvisioningTest.createIU("A", Version.create("1.0.0"));
try (OutputStream output = new FileOutputStream(testFile)) {
- IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, false, null);
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] { iu }, false, null);
assertTrue("Not expected return result.", status.isOK());
}
try (InputStream input = new FileInputStream(testFile)) {
List<IUDetail> ius = importexportService.importP2F(input);
assertEquals("Exported the number of features is not expected.", 1, ius.size());
assertTrue("Exported feature is not expected.", iu.equals(ius.get(0).getIU()));
- assertEquals("Exported the number of referred repositories is not expected.", 1, ius.get(0).getReferencedRepositories().size());
- assertEquals("Exported referred repository is not expected.", uri, ius.get(0).getReferencedRepositories().get(0));
+ assertEquals("Exported the number of referred repositories is not expected.", 1,
+ ius.get(0).getReferencedRepositories().size());
+ assertEquals("Exported referred repository is not expected.", uri,
+ ius.get(0).getReferencedRepositories().get(0));
}
} finally {
testFile.delete();
@@ -95,7 +99,8 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
String osPath = new Path(FileLocator.toFileURL(base).getPath()).toOSString();
File result = new File(osPath);
if (!result.getCanonicalPath().equals(result.getPath()))
- fail(message + " result path: " + result.getPath() + " does not match canonical path: " + result.getCanonicalFile().getPath());
+ fail(message + " result path: " + result.getPath() + " does not match canonical path: "
+ + result.getCanonicalFile().getPath());
return result;
} catch (IOException e) {
fail(message);
@@ -104,11 +109,12 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
return null;
}
- public void testExportFeaturesFromBothRemoteRepositoryAndLocalRepository() throws URISyntaxException, IOException, ProvisionException, OperationCanceledException {
+ public void testExportFeaturesFromBothRemoteRepositoryAndLocalRepository()
+ throws URISyntaxException, IOException, ProvisionException, OperationCanceledException {
File testFile = File.createTempFile("test", "p2f");
URI uri = getTestRepository();
try {
- IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager metaManager = getAgent().getService(IMetadataRepositoryManager.class);
File localRepoFile = getTestData("Error load data", "testData/importexport/repo1");
IMetadataRepository localRepo = metaManager.loadRepository(localRepoFile.toURI(), null);
assertNotNull("Fail to load local repo", localRepo);
@@ -116,15 +122,17 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
assertNotNull("Fail to load remote repo", repo);
IInstallableUnit iu = AbstractProvisioningTest.createIU("A", Version.create("1.0.0"));
try (OutputStream output = new FileOutputStream(testFile)) {
- IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, false, null);
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] { iu }, false, null);
assertTrue("Not expected return result.", status.isOK());
}
try (InputStream input = new FileInputStream(testFile)) {
List<IUDetail> ius = importexportService.importP2F(input);
assertEquals("Exported the number of features is not expected.", 1, ius.size());
assertTrue("Exported feature is not expected.", iu.equals(ius.get(0).getIU()));
- assertEquals("Exported the number of referred repositories is not expected.", 1, ius.get(0).getReferencedRepositories().size());
- assertEquals("Exported referred repository is not expected.", uri, ius.get(0).getReferencedRepositories().get(0));
+ assertEquals("Exported the number of referred repositories is not expected.", 1,
+ ius.get(0).getReferencedRepositories().size());
+ assertEquals("Exported referred repository is not expected.", uri,
+ ius.get(0).getReferencedRepositories().get(0));
}
} finally {
testFile.delete();
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java
index 7cc7b3e54..84353aeea 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java
@@ -73,7 +73,8 @@ public class ImportExportTests extends AbstractProvisioningTest {
if ("org.polarion.eclipse.team.svn.connector.feature.group".equals(iu.getIU().getId())) {
counter++;
assertTrue("Should have two referred repository.", iu.getReferencedRepositories().size() == 2);
- } else if ("org.polarion.eclipse.team.svn.connector.svnkit16.feature.group".equals(iu.getIU().getId())) {
+ } else if ("org.polarion.eclipse.team.svn.connector.svnkit16.feature.group"
+ .equals(iu.getIU().getId())) {
counter++;
assertTrue("Should have one referred repository", iu.getReferencedRepositories().size() == 1);
}
@@ -102,39 +103,42 @@ public class ImportExportTests extends AbstractProvisioningTest {
}
}
- public void testExportFeaturesInstalledFromLocal() throws ProvisionException, OperationCanceledException, IOException {
+ public void testExportFeaturesInstalledFromLocal()
+ throws ProvisionException, OperationCanceledException, IOException {
File testFile = File.createTempFile("test", "p2f");
try {
- IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager metaManager = getAgent().getService(IMetadataRepositoryManager.class);
File localRepoFile = getTestData("Error load data", "testData/importexport/repo1");
IMetadataRepository repo = metaManager.loadRepository(localRepoFile.toURI(), null);
assertNotNull("Fail to load local repo", repo);
IInstallableUnit iu = createIU("A", Version.create("1.0.0"));
try (OutputStream output = new FileOutputStream(testFile)) {
- IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, false, null);
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] { iu }, false, null);
assertFalse("Not expected return result.", status.isOK());
assertTrue("Should be a multiple status", status.isMultiStatus());
boolean hasFeaturesIgnored = false;
for (IStatus s : getChildren(status))
if (s.getCode() == ImportExportImpl.IGNORE_LOCAL_REPOSITORY)
hasFeaturesIgnored = true;
- assertTrue("Should have features ignored due to they're installed from local repository.", hasFeaturesIgnored);
+ assertTrue("Should have features ignored due to they're installed from local repository.",
+ hasFeaturesIgnored);
}
} finally {
testFile.delete();
}
}
- public void testAllowExportFeaturesInstalledFromLocal() throws ProvisionException, OperationCanceledException, IOException {
+ public void testAllowExportFeaturesInstalledFromLocal()
+ throws ProvisionException, OperationCanceledException, IOException {
File testFile = File.createTempFile("test", "p2f");
try {
- IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager metaManager = getAgent().getService(IMetadataRepositoryManager.class);
File localRepoFile = getTestData("Error load data", "testData/importexport/repo1");
IMetadataRepository repo = metaManager.loadRepository(localRepoFile.toURI(), null);
assertNotNull("Fail to load local repo", repo);
IInstallableUnit iu = createIU("A", Version.create("1.0.0"));
try (OutputStream output = new FileOutputStream(testFile)) {
- IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, true, null);
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] { iu }, true, null);
assertTrue(status.isOK());
}
} finally {
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java
index b0c629150..c9ab3a6ef 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java
@@ -87,14 +87,16 @@ public abstract class AbstractProvisioningUITest extends AbstractProvisioningTes
install((nested = createIU(NESTEDIU)), false, false);
install((locked = createIU(LOCKEDIU)), true, true);
uninstalled = createIU(UNINSTALLEDIU);
- IUpdateDescriptor update = MetadataFactory.createUpdateDescriptor(TOPLEVELIU, new VersionRange("[1.0.0, 1.0.0]"), 0, "update description");
- upgrade = createIU(TOPLEVELIU, Version.createOSGi(2, 0, 0), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, null, NO_TP_DATA, false, update, NO_REQUIRES);
+ IUpdateDescriptor update = MetadataFactory.createUpdateDescriptor(TOPLEVELIU,
+ new VersionRange("[1.0.0, 1.0.0]"), 0, "update description");
+ upgrade = createIU(TOPLEVELIU, Version.createOSGi(2, 0, 0), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, null,
+ NO_TP_DATA, false, update, NO_REQUIRES);
category = createNamedIU(CATEGORYIU, CATEGORYIU, Version.create("1.0.0"), true);
- createTestMetdataRepository(new IInstallableUnit[] {top1, top2, uninstalled, upgrade});
+ createTestMetdataRepository(new IInstallableUnit[] { top1, top2, uninstalled, upgrade });
- metaManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
- artifactManager = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
+ metaManager = getAgent().getService(IMetadataRepositoryManager.class);
+ artifactManager = getAgent().getService(IArtifactRepositoryManager.class);
File site = new File(TestActivator.getTestDataFolder().toString(), TEST_REPO_PATH);
testRepoLocation = site.toURI();
metaManager.addRepository(testRepoLocation);
@@ -137,15 +139,18 @@ public abstract class AbstractProvisioningUITest extends AbstractProvisioningTes
req.setInstallableUnitProfileProperty(iu, IProfile.PROP_PROFILE_ROOT_IU, Boolean.toString(true));
}
if (lock) {
- req.setInstallableUnitProfileProperty(iu, IProfile.PROP_PROFILE_LOCKED_IU, Integer.valueOf(IProfile.LOCK_UNINSTALL | IProfile.LOCK_UPDATE).toString());
+ req.setInstallableUnitProfileProperty(iu, IProfile.PROP_PROFILE_LOCKED_IU,
+ Integer.valueOf(IProfile.LOCK_UNINSTALL | IProfile.LOCK_UPDATE).toString());
}
// Use an empty provisioning context to prevent repo access
ProvisioningContext context = new ProvisioningContext(getAgent());
context.setMetadataRepositories(new URI[] {});
- IProvisioningPlan plan = getPlanner(getSession().getProvisioningAgent()).getProvisioningPlan(req, context, getMonitor());
+ IProvisioningPlan plan = getPlanner(getSession().getProvisioningAgent()).getProvisioningPlan(req, context,
+ getMonitor());
if (plan.getStatus().getSeverity() == IStatus.ERROR || plan.getStatus().getSeverity() == IStatus.CANCEL)
return plan.getStatus();
- return getSession().performProvisioningPlan(plan, PhaseSetFactory.createDefaultPhaseSet(), new ProvisioningContext(getAgent()), getMonitor());
+ return getSession().performProvisioningPlan(plan, PhaseSetFactory.createDefaultPhaseSet(),
+ new ProvisioningContext(getAgent()), getMonitor());
}
protected IInstallableUnit createNamedIU(String id, String name, Version version, boolean isCategory) {
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java
index 3f0c56f84..8c102ab0b 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java
@@ -39,8 +39,9 @@ import org.osgi.framework.Constants;
*/
public class RemediationTest extends WizardTest {
- // private static final String AVAILABLE_SOFTWARE_PAGE = "AvailableSoftwarePage";
- // private static final String MAIN_IU = "MainIU";
+ // private static final String AVAILABLE_SOFTWARE_PAGE =
+ // "AvailableSoftwarePage";
+ // private static final String MAIN_IU = "MainIU";
public static final int INSTALLATION_SUCCEEDED = 1;
public static final int INSTALLATION_REMEDIATED = 2;
public static final int INSTALLATION_FAILED = 3;
@@ -63,7 +64,7 @@ public class RemediationTest extends WizardTest {
IInstallableUnit toInstall;
public void visibleSetup(int type) throws Exception {
- //Clearout repositories
+ // Clearout repositories
name = "PROFILE_" + type;
URI[] repos = getMetadataRepositoryManager().getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
for (URI uri : repos) {
@@ -86,41 +87,43 @@ public class RemediationTest extends WizardTest {
regLicenseManager = TestActivator.getContext().registerService(LicenseManager.class, manager, properties);
profileElement = new ProfileElement(null, name);
IULoader.loadIUs(this);
- ILicense[] licenses = new ILicense[] {MetadataFactory.createLicense(URI.create("http://eclipse.org"), "license text"), MetadataFactory.createLicense(URI.create("http://apache.org"), "license text2")};
+ ILicense[] licenses = new ILicense[] {
+ MetadataFactory.createLicense(URI.create("http://eclipse.org"), "license text"),
+ MetadataFactory.createLicense(URI.create("http://apache.org"), "license text2") };
((InstallableUnit) jboss60).setLicenses(licenses);
switch (type) {
- case INSTALLATION_SUCCEEDED :
- createTestMetdataRepository(new IInstallableUnit[] {jboss60, m2e11, m2e12});
- install(m2e12, true, false);
- toInstall = jboss60;
- break;
- case INSTALLATION_REMEDIATED :
- createTestMetdataRepository(new IInstallableUnit[] {jboss60, m2e11, m2e12});
- install(m2e11, true, false);
- toInstall = jboss60;
- break;
- case INSTALLATION_FAILED :
- createTestMetdataRepository(new IInstallableUnit[] {jboss60, m2e11});
- install(m2e11, true, false);
- toInstall = jboss60;
- break;
- case CHECK_FOR_UPDATES :
- createTestMetdataRepository(new IInstallableUnit[] {jboss60, m2e11, m2e12});
- install(m2e11, true, false);
- break;
- case UPDATE_ONE_IU :
- createTestMetdataRepository(new IInstallableUnit[] {jboss55, jboss60, m2e11, m2e12});
- install(jboss55, true, false);
- install(m2e11, true, false);
- break;
- default :
- createTestMetdataRepository(new IInstallableUnit[] {jboss60, m2e11});
- install(m2e11, true, false);
+ case INSTALLATION_SUCCEEDED:
+ createTestMetdataRepository(new IInstallableUnit[] { jboss60, m2e11, m2e12 });
+ install(m2e12, true, false);
+ toInstall = jboss60;
+ break;
+ case INSTALLATION_REMEDIATED:
+ createTestMetdataRepository(new IInstallableUnit[] { jboss60, m2e11, m2e12 });
+ install(m2e11, true, false);
+ toInstall = jboss60;
+ break;
+ case INSTALLATION_FAILED:
+ createTestMetdataRepository(new IInstallableUnit[] { jboss60, m2e11 });
+ install(m2e11, true, false);
+ toInstall = jboss60;
+ break;
+ case CHECK_FOR_UPDATES:
+ createTestMetdataRepository(new IInstallableUnit[] { jboss60, m2e11, m2e12 });
+ install(m2e11, true, false);
+ break;
+ case UPDATE_ONE_IU:
+ createTestMetdataRepository(new IInstallableUnit[] { jboss55, jboss60, m2e11, m2e12 });
+ install(jboss55, true, false);
+ install(m2e11, true, false);
+ break;
+ default:
+ createTestMetdataRepository(new IInstallableUnit[] { jboss60, m2e11 });
+ install(m2e11, true, false);
}
- metaManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
- artifactManager = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
+ metaManager = getAgent().getService(IMetadataRepositoryManager.class);
+ artifactManager = getAgent().getService(IArtifactRepositoryManager.class);
File site = new File(TestActivator.getTestDataFolder().toString(), TEST_REPO_PATH);
testRepoLocation = site.toURI();
metaManager.addRepository(testRepoLocation);
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/TranslationSupportTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/TranslationSupportTests.java
index 1349af791..a378d88dd 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/TranslationSupportTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/TranslationSupportTests.java
@@ -47,7 +47,7 @@ public class TranslationSupportTests extends AbstractQueryTest {
}
public void testFeatureProperties() {
- IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager repoMan = getAgent().getService(IMetadataRepositoryManager.class);
File site = getTestData("0.1", "/testData/metadataRepo/externalized");
URI location = site.toURI();
IMetadataRepository repository;
@@ -57,7 +57,8 @@ public class TranslationSupportTests extends AbstractQueryTest {
fail("1.99", e);
return;
}
- IQueryResult<IInstallableUnit> result = repository.query(QueryUtil.createIUQuery("test.feature.feature.group"), getMonitor());
+ IQueryResult<IInstallableUnit> result = repository.query(QueryUtil.createIUQuery("test.feature.feature.group"),
+ getMonitor());
assertTrue("1.0", !result.isEmpty());
IInstallableUnit unit = result.iterator().next();
@@ -65,7 +66,7 @@ public class TranslationSupportTests extends AbstractQueryTest {
assertEquals("1.1", "Test Copyright", copyright.getBody());
ILicense license = unit.getLicenses(null).iterator().next();
assertEquals("1.2", "Test License", license.getBody());
- // assertEquals("1.3", "license.html", license.getURL().toExternalForm());
+ // assertEquals("1.3", "license.html", license.getURL().toExternalForm());
String name = unit.getProperty(IInstallableUnit.PROP_NAME, null);
assertEquals("1.4", "Test Feature Name", name);
String description = unit.getProperty(IInstallableUnit.PROP_DESCRIPTION, null);
@@ -78,13 +79,16 @@ public class TranslationSupportTests extends AbstractQueryTest {
String germanLicense = "German License";
String canadianFRLicense = "Canadian French License";
- // Create a IU that has a license, but the license body is simply %license. This will be filled in by
+ // Create a IU that has a license, but the license body is simply %license. This
+ // will be filled in by
// a fragment
org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription iuDescription = new org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription();
iuDescription.setId("some IU");
iuDescription.setVersion(Version.createOSGi(1, 0, 0));
- iuDescription.setLicenses(new ILicense[] {MetadataFactory.createLicense(new URI("http://example.com"), "%license")});
- iuDescription.addProvidedCapabilities(Collections.singleton(MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, "some IU", Version.createOSGi(1, 0, 0))));
+ iuDescription.setLicenses(
+ new ILicense[] { MetadataFactory.createLicense(new URI("http://example.com"), "%license") });
+ iuDescription.addProvidedCapabilities(Collections.singleton(MetadataFactory
+ .createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, "some IU", Version.createOSGi(1, 0, 0))));
IInstallableUnit iu = MetadataFactory.createInstallableUnit(iuDescription);
// Create a bunch of fragments which spec our IU as their host
@@ -93,36 +97,47 @@ public class TranslationSupportTests extends AbstractQueryTest {
org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription installableUnitFragmentDescription = new org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription();
installableUnitFragmentDescription.setId("fragment number: " + i);
installableUnitFragmentDescription.setVersion(Version.createOSGi(1, 0, 0));
- installableUnitFragmentDescription.setHost(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "some IU", ANY_VERSION, null, false, false)});
- installableUnitFragmentDescription.setProperty(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription.PROP_TYPE_FRAGMENT, "true");
- IInstallableUnitFragment iuFragment = MetadataFactory.createInstallableUnitFragment(installableUnitFragmentDescription);
+ installableUnitFragmentDescription.setHost(new IRequirement[] { MetadataFactory
+ .createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "some IU", ANY_VERSION, null, false, false) });
+ installableUnitFragmentDescription.setProperty(
+ org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription.PROP_TYPE_FRAGMENT,
+ "true");
+ IInstallableUnitFragment iuFragment = MetadataFactory
+ .createInstallableUnitFragment(installableUnitFragmentDescription);
profile.addInstallableUnit(iuFragment);
}
// Create fragment with a German license
org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription installableUnitFragmentDescription = new org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription();
- IProvidedCapability providedCapability = MetadataFactory.createProvidedCapability("org.eclipse.equinox.p2.localization", "de", Version.createOSGi(1, 0, 0));
+ IProvidedCapability providedCapability = MetadataFactory
+ .createProvidedCapability("org.eclipse.equinox.p2.localization", "de", Version.createOSGi(1, 0, 0));
ArrayList<IProvidedCapability> list = new ArrayList<>();
list.add(providedCapability);
installableUnitFragmentDescription.addProvidedCapabilities(list);
installableUnitFragmentDescription.setId("german fragment");
installableUnitFragmentDescription.setVersion(Version.createOSGi(1, 0, 0));
- installableUnitFragmentDescription.setHost(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "some IU", ANY_VERSION, null, false, false)});
- installableUnitFragmentDescription.setProperty(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription.PROP_TYPE_FRAGMENT, "true");
+ installableUnitFragmentDescription.setHost(new IRequirement[] { MetadataFactory
+ .createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "some IU", ANY_VERSION, null, false, false) });
+ installableUnitFragmentDescription.setProperty(
+ org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription.PROP_TYPE_FRAGMENT, "true");
installableUnitFragmentDescription.setProperty("de.license", germanLicense);
- IInstallableUnitFragment iuFragment = MetadataFactory.createInstallableUnitFragment(installableUnitFragmentDescription);
+ IInstallableUnitFragment iuFragment = MetadataFactory
+ .createInstallableUnitFragment(installableUnitFragmentDescription);
profile.addInstallableUnit(iuFragment);
// Create a French fragment with an fr_CA license
installableUnitFragmentDescription = new org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription();
- providedCapability = MetadataFactory.createProvidedCapability("org.eclipse.equinox.p2.localization", "fr", Version.createOSGi(1, 0, 0));
+ providedCapability = MetadataFactory.createProvidedCapability("org.eclipse.equinox.p2.localization", "fr",
+ Version.createOSGi(1, 0, 0));
list = new ArrayList<>();
list.add(providedCapability);
installableUnitFragmentDescription.addProvidedCapabilities(list);
installableUnitFragmentDescription.setId("cnd french fragment");
installableUnitFragmentDescription.setVersion(Version.createOSGi(1, 0, 0));
- installableUnitFragmentDescription.setHost(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "some IU", ANY_VERSION, null, false, false)});
- installableUnitFragmentDescription.setProperty(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription.PROP_TYPE_FRAGMENT, "true");
+ installableUnitFragmentDescription.setHost(new IRequirement[] { MetadataFactory
+ .createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "some IU", ANY_VERSION, null, false, false) });
+ installableUnitFragmentDescription.setProperty(
+ org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription.PROP_TYPE_FRAGMENT, "true");
installableUnitFragmentDescription.setProperty("fr_CA.license", canadianFRLicense);
iuFragment = MetadataFactory.createInstallableUnitFragment(installableUnitFragmentDescription);

Back to the top