Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalizationTests.java')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalizationTests.java340
1 files changed, 173 insertions, 167 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalizationTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalizationTests.java
index cc86e8512..5a69e5c5a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalizationTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalizationTests.java
@@ -16,15 +16,15 @@ import java.util.Locale;
import junit.framework.TestCase;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.p2.metadata.TranslationSupport;
import org.eclipse.equinox.internal.p2.updatesite.SiteXMLAction;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery;
import org.eclipse.equinox.p2.publisher.PublisherInfo;
import org.eclipse.equinox.p2.publisher.PublisherResult;
import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction;
import org.eclipse.equinox.p2.publisher.eclipse.FeaturesAction;
-import org.eclipse.equinox.p2.tests.IUPropertyUtils;
+import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.tests.TestData;
/**
@@ -33,8 +33,14 @@ import org.eclipse.equinox.p2.tests.TestData;
public class LocalizationTests extends TestCase {
private PublisherInfo info;
- private PublisherResult results;
private IProgressMonitor monitor;
+ private PublisherResult results;
+
+ private TranslationSupport getTranslationSupport() {
+ TranslationSupport utils = new TranslationSupport();
+ utils.setTranslationSource(results.query(new InstallableUnitQuery((String) null), monitor));
+ return utils;
+ }
/* (non-Javadoc)
* @see junit.framework.TestCase#setUp()
@@ -46,132 +52,87 @@ public class LocalizationTests extends TestCase {
monitor = new NullProgressMonitor();
}
- public void testFeatureLocalizationDefault() throws IOException {
- File file = TestData.getFile("localizationtests/foofeature", "");
- FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
- featuresAction.perform(info, results, monitor);
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("fooFeature.feature.group"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "Foo English Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME));
- assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER));
- assertEquals("1.3", "Foo English Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION));
- assertEquals("1.4", "Foo English Copyright", utils.getCopyright(iu).getBody());
- assertEquals("1.5", "Foo English License", utils.getLicense(iu).getBody());
+ public void testBundleLocalizationDE() throws IOException {
+ File file = TestData.getFile("localizationtests/foobundle", "");
+ BundlesAction action = new BundlesAction(new File[] {file});
+ action.perform(info, results, monitor);
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("foobundle"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "Foo German Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
+ assertEquals("1.1", "Foo German Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
}
- public void testFeatureLocalizationEN() throws IOException {
- File file = TestData.getFile("localizationtests/foofeature", "");
- FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
- featuresAction.perform(info, results, monitor);
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("fooFeature.feature.group"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "Foo English Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH));
- assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH));
- assertEquals("1.3", "Foo English Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.ENGLISH));
- assertEquals("1.4", "Foo English Copyright", utils.getCopyright(iu, Locale.ENGLISH).getBody());
- assertEquals("1.5", "Foo English License", utils.getLicense(iu, Locale.ENGLISH).getBody());
+ public void testBundleLocalizationDE_alternatePropFile() throws IOException {
+ File file = TestData.getFile("localizationtests/barbundle", "");
+ BundlesAction action = new BundlesAction(new File[] {file});
+ action.perform(info, results, monitor);
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("barbundle"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "Bar German Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
+ assertEquals("1.1", "Bar German Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
}
- public void testFeatureLocalizatioDE() throws IOException {
- File file = TestData.getFile("localizationtests/foofeature", "");
- FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
- featuresAction.perform(info, results, monitor);
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("fooFeature.feature.group"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "Foo German Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN));
- assertEquals("1.1", "Foo German Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN));
- assertEquals("1.3", "Foo German Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.GERMAN));
- assertEquals("1.4", "Foo German Copyright", utils.getCopyright(iu, Locale.GERMAN).getBody());
- assertEquals("1.5", "Foo German License", utils.getLicense(iu, Locale.GERMAN).getBody());
- }
+ public void testBundleLocalizationDE_alternatePropFile_fragment() throws IOException {
+ File bundle = TestData.getFile("localizationtests/barbundle2", "");
+ File fragment = TestData.getFile("localizationtests/barfragment2", "");
+ BundlesAction action = new BundlesAction(new File[] {bundle, fragment});
+ action.perform(info, results, monitor);
- public void testFeatureJarLocalizationDefault() throws IOException {
- File file = TestData.getFile("localizationtests/foofeature", "");
- FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
- featuresAction.perform(info, results, monitor);
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("fooFeature.feature.jar"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "Foo English Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME));
- assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER));
- assertEquals("1.3", "Foo English Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION));
- assertEquals("1.4", "Foo English Copyright", utils.getCopyright(iu).getBody());
- assertEquals("1.5", "Foo English License", utils.getLicense(iu).getBody());
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("barbundle2"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "Bar German Bundle - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
+ assertEquals("1.1", "Bar German Provider - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
}
- public void testFeatureJarLocalizationEN() throws IOException {
- File file = TestData.getFile("localizationtests/foofeature", "");
- FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
- featuresAction.perform(info, results, monitor);
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("fooFeature.feature.jar"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "Foo English Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH));
- assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH));
- assertEquals("1.3", "Foo English Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.ENGLISH));
- assertEquals("1.4", "Foo English Copyright", utils.getCopyright(iu, Locale.ENGLISH).getBody());
- assertEquals("1.5", "Foo English License", utils.getLicense(iu, Locale.ENGLISH).getBody());
- }
+ public void testBundleLocalizationDE_fragment() throws IOException {
+ File bundle = TestData.getFile("localizationtests/foobundle2", "");
+ File fragment = TestData.getFile("localizationtests/foofragment2", "");
+ BundlesAction action = new BundlesAction(new File[] {bundle, fragment});
+ action.perform(info, results, monitor);
- public void testFeatureJarLocalizatioDE() throws IOException {
- File file = TestData.getFile("localizationtests/foofeature", "");
- FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
- featuresAction.perform(info, results, monitor);
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("fooFeature.feature.jar"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "Foo German Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN));
- assertEquals("1.1", "Foo German Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN));
- assertEquals("1.3", "Foo German Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.GERMAN));
- assertEquals("1.4", "Foo German Copyright", utils.getCopyright(iu, Locale.GERMAN).getBody());
- assertEquals("1.5", "Foo German License", utils.getLicense(iu, Locale.GERMAN).getBody());
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("foobundle2"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "Foo German Bundle - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
+ assertEquals("1.1", "Foo German Provider - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
}
public void testBundleLocalizationEN() throws IOException {
File file = TestData.getFile("localizationtests/foobundle", "");
BundlesAction action = new BundlesAction(new File[] {file});
action.perform(info, results, monitor);
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("foobundle"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "Foo English Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH));
- assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH));
- }
-
- public void testBundleLocalizationDE() throws IOException {
- File file = TestData.getFile("localizationtests/foobundle", "");
- BundlesAction action = new BundlesAction(new File[] {file});
- action.perform(info, results, monitor);
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("foobundle"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "Foo German Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN));
- assertEquals("1.1", "Foo German Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN));
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("foobundle"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "Foo English Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
+ assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
}
public void testBundleLocalizationEN_alternatePropFile() throws IOException {
File file = TestData.getFile("localizationtests/barbundle", "");
BundlesAction action = new BundlesAction(new File[] {file});
action.perform(info, results, monitor);
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("barbundle"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "Bar English Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH));
- assertEquals("1.1", "Bar English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH));
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("barbundle"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "Bar English Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
+ assertEquals("1.1", "Bar English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
}
- public void testBundleLocalizationDE_alternatePropFile() throws IOException {
- File file = TestData.getFile("localizationtests/barbundle", "");
- BundlesAction action = new BundlesAction(new File[] {file});
+ public void testBundleLocalizationEN_alternatePropFile_fragment() throws IOException {
+ File bundle = TestData.getFile("localizationtests/barbundle2", "");
+ File fragment = TestData.getFile("localizationtests/barfragment2", "");
+ BundlesAction action = new BundlesAction(new File[] {bundle, fragment});
action.perform(info, results, monitor);
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("barbundle"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "Bar German Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN));
- assertEquals("1.1", "Bar German Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN));
+
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("barbundle2"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "Bar English Bundle - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
+ assertEquals("1.1", "Bar English Provider - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
}
public void testBundleLocalizationEN_fragment() throws IOException {
@@ -180,79 +141,124 @@ public class LocalizationTests extends TestCase {
BundlesAction action = new BundlesAction(new File[] {bundle, fragment});
action.perform(info, results, monitor);
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("foobundle2"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "Foo English Bundle - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH));
- assertEquals("1.1", "Foo English Provider - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH));
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("foobundle2"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "Foo English Bundle - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
+ assertEquals("1.1", "Foo English Provider - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
}
- public void testBundleLocalizationDE_fragment() throws IOException {
- File bundle = TestData.getFile("localizationtests/foobundle2", "");
- File fragment = TestData.getFile("localizationtests/foofragment2", "");
- BundlesAction action = new BundlesAction(new File[] {bundle, fragment});
- action.perform(info, results, monitor);
+ public void testFeatureJarLocalizatioDE() throws IOException {
+ File file = TestData.getFile("localizationtests/foofeature", "");
+ FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
+ featuresAction.perform(info, results, monitor);
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("fooFeature.feature.jar"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "Foo German Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
+ assertEquals("1.1", "Foo German Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
+ assertEquals("1.3", "Foo German Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.GERMAN.toString()));
+ assertEquals("1.4", "Foo German Copyright", utils.getCopyright(iu, Locale.GERMAN.toString()).getBody());
+ assertEquals("1.5", "Foo German License", utils.getLicenses(iu, Locale.GERMAN.toString())[0].getBody());
+ }
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("foobundle2"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "Foo German Bundle - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN));
- assertEquals("1.1", "Foo German Provider - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN));
+ public void testFeatureJarLocalizationDefault() throws IOException {
+ File file = TestData.getFile("localizationtests/foofeature", "");
+ FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
+ featuresAction.perform(info, results, monitor);
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("fooFeature.feature.jar"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "Foo English Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME));
+ assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER));
+ assertEquals("1.3", "Foo English Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION));
+ assertEquals("1.4", "Foo English Copyright", utils.getCopyright(iu, null).getBody());
+ assertEquals("1.5", "Foo English License", utils.getLicenses(iu, null)[0].getBody());
}
- public void testBundleLocalizationEN_alternatePropFile_fragment() throws IOException {
- File bundle = TestData.getFile("localizationtests/barbundle2", "");
- File fragment = TestData.getFile("localizationtests/barfragment2", "");
- BundlesAction action = new BundlesAction(new File[] {bundle, fragment});
- action.perform(info, results, monitor);
+ public void testFeatureJarLocalizationEN() throws IOException {
+ File file = TestData.getFile("localizationtests/foofeature", "");
+ FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
+ featuresAction.perform(info, results, monitor);
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("fooFeature.feature.jar"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "Foo English Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
+ assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
+ assertEquals("1.3", "Foo English Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.ENGLISH.toString()));
+ assertEquals("1.4", "Foo English Copyright", utils.getCopyright(iu, Locale.ENGLISH.toString()).getBody());
+ assertEquals("1.5", "Foo English License", utils.getLicenses(iu, Locale.ENGLISH.toString())[0].getBody());
+ }
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("barbundle2"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "Bar English Bundle - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH));
- assertEquals("1.1", "Bar English Provider - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH));
+ public void testFeatureLocalizatioDE() throws IOException {
+ File file = TestData.getFile("localizationtests/foofeature", "");
+ FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
+ featuresAction.perform(info, results, monitor);
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("fooFeature.feature.group"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "Foo German Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
+ assertEquals("1.1", "Foo German Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
+ assertEquals("1.3", "Foo German Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.GERMAN.toString()));
+ assertEquals("1.4", "Foo German Copyright", utils.getCopyright(iu, Locale.GERMAN.toString()).getBody());
+ assertEquals("1.5", "Foo German License", utils.getLicenses(iu, Locale.GERMAN.toString())[0].getBody());
}
- public void testBundleLocalizationDE_alternatePropFile_fragment() throws IOException {
- File bundle = TestData.getFile("localizationtests/barbundle2", "");
- File fragment = TestData.getFile("localizationtests/barfragment2", "");
- BundlesAction action = new BundlesAction(new File[] {bundle, fragment});
- action.perform(info, results, monitor);
+ public void testFeatureLocalizationDefault() throws IOException {
+ File file = TestData.getFile("localizationtests/foofeature", "");
+ FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
+ featuresAction.perform(info, results, monitor);
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("fooFeature.feature.group"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "Foo English Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME));
+ assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER));
+ assertEquals("1.3", "Foo English Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION));
+ assertEquals("1.4", "Foo English Copyright", utils.getCopyright(iu, null).getBody());
+ assertEquals("1.5", "Foo English License", utils.getLicenses(iu, null)[0].getBody());
+ }
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("barbundle2"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "Bar German Bundle - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN));
- assertEquals("1.1", "Bar German Provider - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN));
+ public void testFeatureLocalizationEN() throws IOException {
+ File file = TestData.getFile("localizationtests/foofeature", "");
+ FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
+ featuresAction.perform(info, results, monitor);
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("fooFeature.feature.group"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "Foo English Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
+ assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
+ assertEquals("1.3", "Foo English Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.ENGLISH.toString()));
+ assertEquals("1.4", "Foo English Copyright", utils.getCopyright(iu, Locale.ENGLISH.toString()).getBody());
+ assertEquals("1.5", "Foo English License", utils.getLicenses(iu, Locale.ENGLISH.toString())[0].getBody());
}
- public void testFragmentTranslation_EN() throws IOException {
+ public void testFragmentTranslation_DE() throws IOException {
File bundle = TestData.getFile("localizationtests/barbundle2", "");
File fragment = TestData.getFile("localizationtests/barfragment2", "");
BundlesAction action = new BundlesAction(new File[] {bundle, fragment});
action.perform(info, results, monitor);
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("barfragment2"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "English Fragment Name", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH));
- assertEquals("1.1", "English Fragment Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH));
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("barfragment2"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "German Fragment Name", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
+ assertEquals("1.1", "German Fragment Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
}
- public void testFragmentTranslation_DE() throws IOException {
+ public void testFragmentTranslation_EN() throws IOException {
File bundle = TestData.getFile("localizationtests/barbundle2", "");
File fragment = TestData.getFile("localizationtests/barfragment2", "");
BundlesAction action = new BundlesAction(new File[] {bundle, fragment});
action.perform(info, results, monitor);
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("barfragment2"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "German Fragment Name", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN));
- assertEquals("1.1", "German Fragment Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN));
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("barfragment2"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "English Fragment Name", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
+ assertEquals("1.1", "English Fragment Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
}
- public void testSite_EN() throws IOException {
+ public void testSite_DE() throws IOException {
File feature = TestData.getFile("localizationtests/foofeature", "");
URI site = TestData.getFile("localizationtests/site", "").toURI();
@@ -261,15 +267,15 @@ public class LocalizationTests extends TestCase {
action.perform(info, results, monitor);
siteAction.perform(info, results, monitor);
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("foo.new_category_1"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "English Category Name", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH));
- assertEquals("1.1", "English Category Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.ENGLISH));
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("foo.new_category_1"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "German Category Name", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
+ assertEquals("1.1", "German Category Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.GERMAN.toString()));
}
- public void testSite_DE() throws IOException {
+ public void testSite_EN() throws IOException {
File feature = TestData.getFile("localizationtests/foofeature", "");
URI site = TestData.getFile("localizationtests/site", "").toURI();
@@ -278,11 +284,11 @@ public class LocalizationTests extends TestCase {
action.perform(info, results, monitor);
siteAction.perform(info, results, monitor);
- IUPropertyUtils utils = new IUPropertyUtils(results.query(new InstallableUnitQuery((String) null), new Collector(), monitor));
- Collector collector = results.query(new InstallableUnitQuery("foo.new_category_1"), new Collector(), monitor);
- IInstallableUnit iu = (IInstallableUnit) collector.iterator().next();
- assertEquals("1.0", "German Category Name", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN));
- assertEquals("1.1", "German Category Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.GERMAN));
+ TranslationSupport utils = getTranslationSupport();
+ IQueryResult queryResult = results.query(new InstallableUnitQuery("foo.new_category_1"), monitor);
+ IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ assertEquals("1.0", "English Category Name", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
+ assertEquals("1.1", "English Category Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.ENGLISH.toString()));
}
}

Back to the top