You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2012/06/12 14:38:32 UTC
svn commit: r1349299 [1/4] - in /incubator/wookie/trunk:
parser/java/src-test/org/apache/wookie/w3c/test/
parser/java/src/org/apache/wookie/w3c/
parser/java/src/org/apache/wookie/w3c/impl/
parser/java/src/org/apache/wookie/w3c/updates/ parser/java/src/...
Author: scottbw
Date: Tue Jun 12 12:38:28 2012
New Revision: 1349299
URL: http://svn.apache.org/viewvc?rev=1349299&view=rev
Log:
Major update to the core Wookie data model, removing redundant/duplicate interfaces, harmonizing method signatures and terminology, and simplifying the default JPA backend. See WOOKIE-345
Added:
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAccess.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAuthor.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IContent.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDescription.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDirectional.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IFeature.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IIcon.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILicense.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILocalized.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IName.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IParam.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IPreference.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/xml/
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/xml/IContentEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/xml/IElement.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/xml/IIconEntity.java
Removed:
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAccessEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAuthorEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IContentEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDescriptionEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IElement.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IFeatureEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IIconEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILicenseEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILocalizedElement.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILocalizedEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/INameEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IParamEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IPreferenceEntity.java
incubator/wookie/trunk/src/org/apache/wookie/beans/IAuthor.java
incubator/wookie/trunk/src/org/apache/wookie/beans/IDescription.java
incubator/wookie/trunk/src/org/apache/wookie/beans/IFeature.java
incubator/wookie/trunk/src/org/apache/wookie/beans/ILicense.java
incubator/wookie/trunk/src/org/apache/wookie/beans/ILocalizedBean.java
incubator/wookie/trunk/src/org/apache/wookie/beans/IName.java
incubator/wookie/trunk/src/org/apache/wookie/beans/IParam.java
incubator/wookie/trunk/src/org/apache/wookie/beans/IPreferenceDefault.java
incubator/wookie/trunk/src/org/apache/wookie/beans/IStartFile.java
incubator/wookie/trunk/src/org/apache/wookie/beans/IWidgetIcon.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/IInverseRelationship.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/InverseRelationshipCollection.java
Modified:
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/ConformanceTest.java
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/EntityTest.java
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/I18n.java
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/LocalizationUtilsTest.java
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/PackagingAndConfiguration.java
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/UpdateConformanceTest.java
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/UpdateUtilsTest.java
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/WidgetOutputterTest.java
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/i18nManual.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IStartPageProcessor.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidget.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidgetFactory.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AbstractLocalizedEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AccessEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/AuthorEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ContentEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/DescriptionEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/FeatureEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/IconEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/LicenseEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/NameEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ParamEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/PreferenceEntity.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/WidgetManifestModel.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/updates/UpdateUtils.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/FormattingUtils.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/LocalizationUtils.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/WidgetOutputter.java
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/OpenSocialUtilsTest.java
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/beans/AbstractPersistenceTest.java
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/flatpack/FlatpackFactoryTest.java
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetsControllerTest.java
incubator/wookie/trunk/src/META-INF/persistence.xml
incubator/wookie/trunk/src/org/apache/wookie/ajaxmodel/impl/WidgetAPIImpl.java
incubator/wookie/trunk/src/org/apache/wookie/beans/IWidget.java
incubator/wookie/trunk/src/org/apache/wookie/beans/IWidgetInstance.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/JPAPersistenceManager.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/AuthorImpl.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/DescriptionImpl.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/FeatureImpl.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/LicenseImpl.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/LocalizedBeanImpl.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/NameImpl.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/ParamImpl.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/PreferenceDefaultImpl.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/PreferenceImpl.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/SharedDataImpl.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/StartFileImpl.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/WidgetIconImpl.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/WidgetImpl.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/WidgetInstanceImpl.java
incubator/wookie/trunk/src/org/apache/wookie/beans/util/PersistenceManagerFactory.java
incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java
incubator/wookie/trunk/src/org/apache/wookie/feature/oauth/oAuthClient.java
incubator/wookie/trunk/src/org/apache/wookie/flatpack/FlatpackFactory.java
incubator/wookie/trunk/src/org/apache/wookie/flatpack/FlatpackProcessor.java
incubator/wookie/trunk/src/org/apache/wookie/helpers/SharedDataHelper.java
incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetAdvertHelper.java
incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetFactory.java
incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetImportHelper.java
incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetInstanceFactory.java
incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetInstanceHelper.java
incubator/wookie/trunk/src/org/apache/wookie/proxy/ProxyServlet.java
incubator/wookie/trunk/src/org/apache/wookie/server/ContextListener.java
incubator/wookie/trunk/src/org/apache/wookie/server/LocalizedResourceFilter.java
incubator/wookie/trunk/src/org/apache/wookie/updates/UpdatesController.java
incubator/wookie/trunk/src/org/apache/wookie/util/WidgetFormattingUtils.java
incubator/wookie/trunk/src/org/apache/wookie/util/gadgets/GadgetAdapter.java
incubator/wookie/trunk/src/org/apache/wookie/util/html/StartPageProcessor.java
incubator/wookie/trunk/src/org/apache/wookie/util/opensocial/OpenSocialUtils.java
Modified: incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/ConformanceTest.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/ConformanceTest.java?rev=1349299&r1=1349298&r2=1349299&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/ConformanceTest.java (original)
+++ incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/ConformanceTest.java Tue Jun 12 12:38:28 2012
@@ -19,11 +19,11 @@ import java.io.File;
import java.io.IOException;
import java.net.URL;
-import org.apache.wookie.w3c.W3CWidget;
import org.apache.wookie.w3c.W3CWidgetFactory;
import org.apache.wookie.w3c.exceptions.BadManifestException;
import org.apache.wookie.w3c.exceptions.BadWidgetZipFileException;
import org.apache.wookie.w3c.exceptions.InvalidContentTypeException;
+import org.apache.wookie.w3c.W3CWidget;
import org.junit.AfterClass;
import org.junit.BeforeClass;
Modified: incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/EntityTest.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/EntityTest.java?rev=1349299&r1=1349298&r2=1349299&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/EntityTest.java (original)
+++ incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/EntityTest.java Tue Jun 12 12:38:28 2012
@@ -23,7 +23,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import org.apache.wookie.w3c.IParamEntity;
+import org.apache.wookie.w3c.IParam;
import org.apache.wookie.w3c.IW3CXMLConfiguration;
import org.apache.wookie.w3c.exceptions.BadManifestException;
import org.apache.wookie.w3c.impl.AuthorEntity;
@@ -86,7 +86,7 @@ public class EntityTest {
assertEquals(true, feature.isRequired());
assertFalse(feature.hasParams());
ParamEntity param = new ParamEntity("name","value");
- List<IParamEntity> params = new ArrayList<IParamEntity>();
+ List<IParam> params = new ArrayList<IParam>();
params.add(param);
feature = new FeatureEntity("http://test",true,params);
assertTrue(feature.hasParams());
Modified: incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/I18n.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/I18n.java?rev=1349299&r1=1349298&r2=1349299&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/I18n.java (original)
+++ incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/I18n.java Tue Jun 12 12:38:28 2012
@@ -18,9 +18,10 @@ import static org.junit.Assert.assertTru
import java.net.MalformedURLException;
import java.net.URL;
-import org.apache.wookie.w3c.IContentEntity;
-import org.apache.wookie.w3c.IFeatureEntity;
+
+import org.apache.wookie.w3c.IFeature;
import org.apache.wookie.w3c.W3CWidget;
+import org.apache.wookie.w3c.xml.IContentEntity;
import org.junit.Test;
/**
@@ -185,18 +186,18 @@ public class I18n extends ConformanceTes
String[] tests = {"005","018"};
for (String id: tests){
W3CWidget widget = getWidget(id,dir);
- assertEquals(dir,widget.getLicensesList().get(0).getDir());
+ assertEquals(dir,widget.getLicenses().get(0).getDir());
}
W3CWidget widget;
// this has inline dir tags. we have to check that we get them correctly and haven't filtered out the span tag.
widget = getWidget("009",dir);
- assertTrue(widget.getLicensesList().get(0).getLicenseText().contains("dir=\""+dir));
+ assertTrue(widget.getLicenses().get(0).getLicenseText().contains("dir=\""+dir));
widget = getWidget("013",dir);
- assertTrue(widget.getLicensesList().get(0).getDir().equals(dir));
+ assertTrue(widget.getLicenses().get(0).getDir().equals(dir));
// this has mixed inline dir tags. we have to check that we get them correctly and haven't filtered out the span tag.
widget = getWidget("038",dir);
- assertEquals("http://widget.example.org/", widget.getLicensesList().get(0).getHref());
+ assertEquals("http://widget.example.org/", widget.getLicenses().get(0).getHref());
}
// ta-roCaKRxZhS
@@ -275,32 +276,32 @@ public class I18n extends ConformanceTes
W3CWidget widget;
widget = getWidget("033","lro");
- assertEquals("×פ××××§", widget.getPrefences().get(0).getName());
+ assertEquals("×פ××××§", widget.getPreferences().get(0).getName());
widget = getWidget("034","lro");
- assertEquals("×פ××××§", widget.getPrefences().get(0).getValue());
+ assertEquals("×פ××××§", widget.getPreferences().get(0).getValue());
widget = getWidget("035","lro");
- assertEquals(true, widget.getPrefences().get(0).isReadOnly());
+ assertEquals(true, widget.getPreferences().get(0).isReadOnly());
widget = getWidget("033","ltr");
- assertEquals("The arrow should point right -->", widget.getPrefences().get(0).getName());
+ assertEquals("The arrow should point right -->", widget.getPreferences().get(0).getName());
widget = getWidget("034","ltr");
- assertEquals("The arrow should point right -->", widget.getPrefences().get(0).getValue());
+ assertEquals("The arrow should point right -->", widget.getPreferences().get(0).getValue());
widget = getWidget("035","ltr");
- assertEquals(true, widget.getPrefences().get(0).isReadOnly());
+ assertEquals(true, widget.getPreferences().get(0).isReadOnly());
widget = getWidget("033","rlo");
- assertEquals("PASSED", widget.getPrefences().get(0).getName());
+ assertEquals("PASSED", widget.getPreferences().get(0).getName());
widget = getWidget("034","rlo");
- assertEquals("PASSED", widget.getPrefences().get(0).getValue());
+ assertEquals("PASSED", widget.getPreferences().get(0).getValue());
widget = getWidget("035","rlo");
- assertEquals(true, widget.getPrefences().get(0).isReadOnly());
+ assertEquals(true, widget.getPreferences().get(0).isReadOnly());
widget = getWidget("033","rtl");
- assertEquals("The arrow should point right -->", widget.getPrefences().get(0).getName());
+ assertEquals("The arrow should point right -->", widget.getPreferences().get(0).getName());
widget = getWidget("034","rtl");
- assertEquals("The arrow should point right -->", widget.getPrefences().get(0).getValue());
+ assertEquals("The arrow should point right -->", widget.getPreferences().get(0).getValue());
widget = getWidget("035","rtl");
- assertEquals(true, widget.getPrefences().get(0).isReadOnly());
+ assertEquals(true, widget.getPreferences().get(0).isReadOnly());
}
// ta-LQcjNKBLUZ
@@ -365,7 +366,7 @@ public class I18n extends ConformanceTes
String[] tests = {"lro","rlo","rtl","ltr"};
for (String dir: tests){
W3CWidget widget = getWidget(id,dir);
- IFeatureEntity feature = widget.getFeatures().get(0);
+ IFeature feature = widget.getFeatures().get(0);
assertEquals(pass_value, feature.getName());
}
}
@@ -417,7 +418,7 @@ public class I18n extends ConformanceTes
return widget;
}
private String getLocalIconPath(W3CWidget widget, int index){
- return getLocalUrl(widget.getIconsList().get(index).getSrc());
+ return getLocalUrl(widget.getIcons().get(index).getSrc());
}
private String getLocalUrl(String src){
Modified: incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/LocalizationUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/LocalizationUtilsTest.java?rev=1349299&r1=1349298&r2=1349299&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/LocalizationUtilsTest.java (original)
+++ incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/LocalizationUtilsTest.java Tue Jun 12 12:38:28 2012
@@ -21,7 +21,7 @@ import static org.junit.Assert.fail;
import java.util.ArrayList;
-import org.apache.wookie.w3c.ILocalizedElement;
+import org.apache.wookie.w3c.ILocalized;
import org.apache.wookie.w3c.util.LocalizationUtils;
import org.junit.Test;
@@ -42,7 +42,7 @@ public class LocalizationUtilsTest {
public static final String[] LANG_LIST_INV_2 = {"x-gb-a-a","12345567889"};
public static final String[] LANG_LIST_INV_3 = {"x-gb-a-a","i-argserg45ggadfgdfsg-4t534","fr"};
- class License implements ILocalizedElement{
+ class License implements ILocalized{
private String lang;
@@ -56,8 +56,8 @@ public class LocalizationUtilsTest {
}
- public ILocalizedElement[] elements(String[] langs){
- ArrayList<ILocalizedElement> licenses = new ArrayList<ILocalizedElement>();
+ public ILocalized[] elements(String[] langs){
+ ArrayList<ILocalized> licenses = new ArrayList<ILocalized>();
for (String lang:langs){
License license = new License();
license.setLang(lang);
@@ -68,7 +68,7 @@ public class LocalizationUtilsTest {
@Test
public void nullTest1(){
- ILocalizedElement[] elements = elements(LANG_LIST_1);
+ ILocalized[] elements = elements(LANG_LIST_1);
elements = LocalizationUtils.processElementsByLocales(elements,null,null);
assertEquals("en", elements[0].getLang());
assertEquals(1, elements.length);
@@ -76,7 +76,7 @@ public class LocalizationUtilsTest {
@Test
public void nullTest2(){
- ILocalizedElement[] elements = elements(LANG_LIST_1);
+ ILocalized[] elements = elements(LANG_LIST_1);
elements = LocalizationUtils.processElementsByLocales(elements,new String[]{null},null);
assertEquals("en", elements[0].getLang());
assertEquals(1, elements.length);
@@ -84,7 +84,7 @@ public class LocalizationUtilsTest {
@Test
public void nullTest3(){
- ILocalizedElement[] elements = elements(LANG_LIST_1);
+ ILocalized[] elements = elements(LANG_LIST_1);
elements = LocalizationUtils.processElementsByLocales(elements,new String[]{null,null,""},null);
assertEquals("en", elements[0].getLang());
assertEquals(1, elements.length);
@@ -92,7 +92,7 @@ public class LocalizationUtilsTest {
@Test
public void nullTest4(){
- ILocalizedElement[] elements = elements(LANG_LIST_11);
+ ILocalized[] elements = elements(LANG_LIST_11);
elements = LocalizationUtils.processElementsByLocales(elements,null,null);
assertEquals(null, elements[0].getLang());
assertEquals(1, elements.length);
@@ -100,16 +100,16 @@ public class LocalizationUtilsTest {
@Test
public void nullTest5(){
- ILocalizedElement[] elements = elements(LANG_LIST_11);
- ILocalizedElement element = LocalizationUtils.getLocalizedElement(elements,null,null);
+ ILocalized[] elements = elements(LANG_LIST_11);
+ ILocalized element = LocalizationUtils.getLocalizedElement(elements,null,null);
assertEquals(null, element.getLang());
}
@Test
public void nullTest6(){
try {
- ILocalizedElement[] elements = null;
- ILocalizedElement element = LocalizationUtils.getLocalizedElement(elements,null,null);
+ ILocalized[] elements = null;
+ ILocalized element = LocalizationUtils.getLocalizedElement(elements,null,null);
assertNull(element);
} catch (Exception e) {
e.printStackTrace();
@@ -120,7 +120,7 @@ public class LocalizationUtilsTest {
@Test
public void nullTest7(){
try {
- ILocalizedElement[] elements = null;
+ ILocalized[] elements = null;
elements = LocalizationUtils.processElementsByDefaultLocales(elements);
assertNull(elements);
} catch (Exception e) {
@@ -131,7 +131,7 @@ public class LocalizationUtilsTest {
@Test
public void nullTest8(){
try {
- ILocalizedElement[] elements = null;
+ ILocalized[] elements = null;
elements = LocalizationUtils.processElementsByLocales(elements,null,null);
assertNull(elements);
} catch (Exception e) {
@@ -143,21 +143,21 @@ public class LocalizationUtilsTest {
// Invalid locales are skipped - if this creates an empty list, then use defaults
@Test
public void invalid(){
- ILocalizedElement[] elements = elements(LANG_LIST_1);
+ ILocalized[] elements = elements(LANG_LIST_1);
elements = LocalizationUtils.processElementsByLocales(elements,LANG_LIST_INV_1,null);
assertEquals("en", elements[0].getLang());
assertEquals(1, elements.length);
}
@Test
public void invalid2(){
- ILocalizedElement[] elements = elements(LANG_LIST_1);
+ ILocalized[] elements = elements(LANG_LIST_1);
elements = LocalizationUtils.processElementsByLocales(elements,LANG_LIST_INV_2,null);
assertEquals("en", elements[0].getLang());
assertEquals(1, elements.length);
}
@Test
public void invalid3(){
- ILocalizedElement[] elements = elements(LANG_LIST_1);
+ ILocalized[] elements = elements(LANG_LIST_1);
elements = LocalizationUtils.processElementsByLocales(elements,LANG_LIST_INV_3,null);
assertEquals("fr", elements[0].getLang());
assertEquals(1, elements.length);
@@ -165,21 +165,21 @@ public class LocalizationUtilsTest {
@Test
public void defaultOrder1(){
- ILocalizedElement[] elements = elements(LANG_LIST_1);
+ ILocalized[] elements = elements(LANG_LIST_1);
elements = LocalizationUtils.processElementsByDefaultLocales(elements);
assertEquals("en", elements[0].getLang());
assertEquals(1, elements.length);
}
@Test
public void defaultOrder2(){
- ILocalizedElement[] elements = elements(LANG_LIST_2);
+ ILocalized[] elements = elements(LANG_LIST_2);
elements = LocalizationUtils.processElementsByDefaultLocales(elements);
assertEquals("en", elements[0].getLang());
assertEquals(1, elements.length);
}
@Test
public void defaultOrder3(){
- ILocalizedElement[] elements = elements(LANG_LIST_3);
+ ILocalized[] elements = elements(LANG_LIST_3);
elements = LocalizationUtils.processElementsByDefaultLocales(elements);
assertEquals("en", elements[0].getLang());
assertEquals(1, elements.length);
@@ -187,21 +187,21 @@ public class LocalizationUtilsTest {
@Test
public void specifiedOrder1(){
- ILocalizedElement[] elements = elements(LANG_LIST_1);
+ ILocalized[] elements = elements(LANG_LIST_1);
elements = LocalizationUtils.processElementsByLocales(elements, LANG_LIST_4,null);
assertEquals("en", elements[0].getLang());
assertEquals(1, elements.length);
}
@Test
public void specifiedOrder2(){
- ILocalizedElement[] elements = elements(LANG_LIST_2);
+ ILocalized[] elements = elements(LANG_LIST_2);
elements = LocalizationUtils.processElementsByLocales(elements, LANG_LIST_4,null);
assertEquals("en", elements[0].getLang());
assertEquals(1, elements.length);
}
@Test
public void specifiedOrder3(){
- ILocalizedElement[] elements = elements(LANG_LIST_3);
+ ILocalized[] elements = elements(LANG_LIST_3);
elements = LocalizationUtils.processElementsByLocales(elements, LANG_LIST_4,null);
assertEquals("en", elements[0].getLang());
assertEquals(1, elements.length);
@@ -209,7 +209,7 @@ public class LocalizationUtilsTest {
@Test
public void noMatch(){
- ILocalizedElement[] elements = elements(LANG_LIST_7);
+ ILocalized[] elements = elements(LANG_LIST_7);
elements = LocalizationUtils.processElementsByLocales(elements, LANG_LIST_4,null);
assertEquals(null, elements[0].getLang());
assertEquals(1, elements.length);
@@ -217,14 +217,14 @@ public class LocalizationUtilsTest {
@Test
public void noMatch3(){
- ILocalizedElement[] elements = elements(LANG_LIST_11);
- ILocalizedElement element = LocalizationUtils.getLocalizedElement(elements, LANG_LIST_4,null);
+ ILocalized[] elements = elements(LANG_LIST_11);
+ ILocalized element = LocalizationUtils.getLocalizedElement(elements, LANG_LIST_4,null);
assertEquals(null,element.getLang());
}
@Test
public void noMatch2(){
- ILocalizedElement[] elements = elements(LANG_LIST_1);
+ ILocalized[] elements = elements(LANG_LIST_1);
elements = LocalizationUtils.processElementsByLocales(elements, LANG_LIST_10,null);
assertEquals(null, elements[0].getLang());
assertEquals(1, elements.length);
@@ -232,7 +232,7 @@ public class LocalizationUtilsTest {
@Test
public void noMatch1(){
- ILocalizedElement[] elements = elements(LANG_LIST_2);
+ ILocalized[] elements = elements(LANG_LIST_2);
elements = LocalizationUtils.processElementsByLocales(elements, LANG_LIST_4,null);
assertEquals(1, elements.length);
}
@@ -240,7 +240,7 @@ public class LocalizationUtilsTest {
@Test
public void specifiedOrderM4(){
- ILocalizedElement[] elements = elements(LANG_LIST_3);
+ ILocalized[] elements = elements(LANG_LIST_3);
elements = LocalizationUtils.processElementsByLocales(elements, LANG_LIST_6,null);
assertEquals("en", elements[0].getLang());
assertEquals("nl", elements[1].getLang());
@@ -248,14 +248,14 @@ public class LocalizationUtilsTest {
}
@Test
public void specifiedOrderM5(){
- ILocalizedElement[] elements = elements(LANG_LIST_3);
+ ILocalized[] elements = elements(LANG_LIST_3);
elements = LocalizationUtils.processElementsByLocales(elements, LANG_LIST_5,null);
assertEquals("en", elements[0].getLang());
assertEquals(1, elements.length);
}
@Test
public void specifiedOrderM6(){
- ILocalizedElement[] elements = elements(LANG_LIST_1);
+ ILocalized[] elements = elements(LANG_LIST_1);
elements = LocalizationUtils.processElementsByLocales(elements, LANG_LIST_6,null);
assertEquals("en", elements[0].getLang());
assertEquals("nl", elements[1].getLang());
@@ -263,7 +263,7 @@ public class LocalizationUtilsTest {
}
@Test
public void specifiedOrderM7(){
- ILocalizedElement[] elements = elements(LANG_LIST_9);
+ ILocalized[] elements = elements(LANG_LIST_9);
elements = LocalizationUtils.processElementsByLocales(elements, LANG_LIST_8,null);
assertEquals("en-us", elements[0].getLang());
assertEquals("en", elements[1].getLang());
@@ -271,7 +271,7 @@ public class LocalizationUtilsTest {
}
@Test
public void classCast(){
- ILocalizedElement[] elements = elements(LANG_LIST_9);
+ ILocalized[] elements = elements(LANG_LIST_9);
elements = LocalizationUtils.processElementsByLocales(elements, LANG_LIST_8,null);
assertEquals("en-us", elements[0].getLang());
assertEquals("en", elements[1].getLang());
@@ -341,7 +341,7 @@ public class LocalizationUtilsTest {
@Test
public void emptyElementList(){
- ILocalizedElement[] elements = elements(new String[0]);
+ ILocalized[] elements = elements(new String[0]);
assertNull(LocalizationUtils.getLocalizedElement(elements, LANG_LIST_1,null));
}
Modified: incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/PackagingAndConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/PackagingAndConfiguration.java?rev=1349299&r1=1349298&r2=1349299&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/PackagingAndConfiguration.java (original)
+++ incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/PackagingAndConfiguration.java Tue Jun 12 12:38:28 2012
@@ -24,15 +24,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
-import org.apache.wookie.w3c.IContentEntity;
-import org.apache.wookie.w3c.IDescriptionEntity;
-import org.apache.wookie.w3c.IFeatureEntity;
-import org.apache.wookie.w3c.IIconEntity;
-import org.apache.wookie.w3c.ILicenseEntity;
-import org.apache.wookie.w3c.INameEntity;
-import org.apache.wookie.w3c.IParamEntity;
-import org.apache.wookie.w3c.IPreferenceEntity;
-import org.apache.wookie.w3c.W3CWidget;
+import org.apache.wookie.w3c.*;
import org.apache.wookie.w3c.exceptions.BadManifestException;
import org.apache.wookie.w3c.exceptions.BadWidgetZipFileException;
import org.apache.wookie.w3c.exceptions.InvalidContentTypeException;
@@ -619,7 +611,7 @@ public class PackagingAndConfiguration e
@Test
public void zz(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-iuJHnskSHq/000/zz.wgt");
- assertEquals(0,widget.getIconsList().size());
+ assertEquals(0,widget.getIcons().size());
}
@Test
public void za(){
@@ -632,88 +624,88 @@ public class PackagingAndConfiguration e
public void zb(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-iuJHnskSHq/002/zb.wgt");
assertEquals("locales/en/icon.png",getIcon(widget));
- assertEquals(null, getIconEntity(widget).getWidth());//getIconEntity(widget).getWidth());
- assertEquals(null, getIconEntity(widget).getHeight());
+ assertEquals(null, getIconObject(widget).getWidth());//getIcon(widget).getWidth());
+ assertEquals(null, getIconObject(widget).getHeight());
}
@Test
public void zc(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-iuJHnskSHq/003/zc.wgt");
assertEquals("locales/en/custom.png",getIcon(widget));
- assertEquals(null, getIconEntity(widget).getWidth());
- assertEquals(null, getIconEntity(widget).getHeight());
+ assertEquals(null, getIconObject(widget).getWidth());
+ assertEquals(null, getIconObject(widget).getHeight());
}
// ta-eHUaPbgfKg
@Test
public void ix(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-eHUaPbgfKg/000/ix.wgt");
- assertEquals(123, getIconEntity(widget).getHeight().intValue());
+ assertEquals(123, getIconObject(widget).getHeight().intValue());
}
@Test
public void iy(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-eHUaPbgfKg/001/iy.wgt");
- assertEquals(0, getIconEntity(widget).getHeight().intValue());
+ assertEquals(0, getIconObject(widget).getHeight().intValue());
}
@Test
public void iz(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-eHUaPbgfKg/002/iz.wgt");
- assertEquals(100, getIconEntity(widget).getHeight().intValue());
+ assertEquals(100, getIconObject(widget).getHeight().intValue());
}
@Test
public void i1(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-eHUaPbgfKg/003/i1.wgt");
- assertEquals(123, getIconEntity(widget).getHeight().intValue());
+ assertEquals(123, getIconObject(widget).getHeight().intValue());
}
@Test
public void i2(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-eHUaPbgfKg/004/i2.wgt");
- assertEquals(null, getIconEntity(widget).getHeight());
+ assertEquals(null, getIconObject(widget).getHeight());
}
@Test
public void i3(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-eHUaPbgfKg/005/i3.wgt");
- assertEquals(null, getIconEntity(widget).getHeight());
+ assertEquals(null, getIconObject(widget).getHeight());
}
@Test
public void i4(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-eHUaPbgfKg/006/i4.wgt");
- assertEquals(0, getIconEntity(widget).getHeight().intValue()); }
+ assertEquals(0, getIconObject(widget).getHeight().intValue()); }
// ta-nYAcofihvj
@Test
public void iq(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-nYAcofihvj/000/iq.wgt");
- assertEquals(123, getIconEntity(widget).getWidth().intValue());
+ assertEquals(123, getIconObject(widget).getWidth().intValue());
}
@Test
public void i9(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-nYAcofihvj/001/i9.wgt");
- assertEquals(0, getIconEntity(widget).getWidth().intValue());
+ assertEquals(0, getIconObject(widget).getWidth().intValue());
}
@Test
public void iw(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-nYAcofihvj/002/iw.wgt");
- assertEquals(100, getIconEntity(widget).getWidth().intValue());
+ assertEquals(100, getIconObject(widget).getWidth().intValue());
}
@Test
public void ie(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-nYAcofihvj/003/ie.wgt");
- assertEquals(123, getIconEntity(widget).getWidth().intValue());
+ assertEquals(123, getIconObject(widget).getWidth().intValue());
}
@Test
public void ir(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-nYAcofihvj/004/ir.wgt");
- assertEquals(null, getIconEntity(widget).getWidth());
+ assertEquals(null, getIconObject(widget).getWidth());
}
@Test
public void it(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-nYAcofihvj/005/it.wgt");
- assertEquals(null, getIconEntity(widget).getWidth());
+ assertEquals(null, getIconObject(widget).getWidth());
}
@Test
public void ib(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-nYAcofihvj/006/ib.wgt");
- assertEquals(0, getIconEntity(widget).getWidth().intValue());
+ assertEquals(0, getIconObject(widget).getWidth().intValue());
}
// ta-sdwhMozwIc
@@ -785,14 +777,14 @@ public class PackagingAndConfiguration e
@Test
public void a5(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-DwhJBIJRQN/000/a5.wgt");
- assertEquals(0,widget.getPrefences().size());
+ assertEquals(0,widget.getPreferences().size());
}
@Test
public void a6(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-DwhJBIJRQN/001/a6.wgt");
- assertTrue(widget.getPrefences().size() == 1);
- IPreferenceEntity pref = widget.getPrefences().get(0);
+ assertTrue(widget.getPreferences().size() == 1);
+ IPreference pref = widget.getPreferences().get(0);
assertEquals("PASS",pref.getName());
assertEquals("PASS", pref.getValue());
assertEquals(false, pref.isReadOnly());
@@ -800,8 +792,8 @@ public class PackagingAndConfiguration e
@Test
public void a7(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-DwhJBIJRQN/002/a7.wgt");
- assertTrue(widget.getPrefences().size() == 1);
- IPreferenceEntity pref = widget.getPrefences().get(0);
+ assertTrue(widget.getPreferences().size() == 1);
+ IPreference pref = widget.getPreferences().get(0);
assertEquals("PASS",pref.getName());
assertEquals("PASS", pref.getValue());
assertEquals(false, pref.isReadOnly());
@@ -809,8 +801,8 @@ public class PackagingAndConfiguration e
@Test
public void a8(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-DwhJBIJRQN/003/a8.wgt");
- assertTrue(widget.getPrefences().size() == 1);
- IPreferenceEntity pref = widget.getPrefences().get(0);
+ assertTrue(widget.getPreferences().size() == 1);
+ IPreference pref = widget.getPreferences().get(0);
assertEquals("PASS",pref.getName());
assertEquals("PASS", pref.getValue());
assertEquals(true, pref.isReadOnly());
@@ -818,8 +810,8 @@ public class PackagingAndConfiguration e
@Test
public void a9(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-DwhJBIJRQN/004/a9.wgt");
- assertTrue(widget.getPrefences().size() == 1);
- IPreferenceEntity pref = widget.getPrefences().get(0);
+ assertTrue(widget.getPreferences().size() == 1);
+ IPreference pref = widget.getPreferences().get(0);
assertEquals("PASS",pref.getName());
assertEquals("PASS", pref.getValue());
assertEquals(false, pref.isReadOnly());
@@ -827,8 +819,8 @@ public class PackagingAndConfiguration e
@Test
public void ba(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-DwhJBIJRQN/005/ba.wgt");
- assertTrue(widget.getPrefences().size() == 1);
- IPreferenceEntity pref = widget.getPrefences().get(0);
+ assertTrue(widget.getPreferences().size() == 1);
+ IPreference pref = widget.getPreferences().get(0);
assertEquals("a",pref.getName());
assertEquals("a", pref.getValue());
assertEquals(false, pref.isReadOnly());
@@ -837,9 +829,9 @@ public class PackagingAndConfiguration e
@Test
public void bb(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-DwhJBIJRQN/006/bb.wgt");
- assertTrue(widget.getPrefences().size() == 2);
- IPreferenceEntity pref1 = widget.getPrefences().get(0);
- IPreferenceEntity pref2 = widget.getPrefences().get(1);
+ assertTrue(widget.getPreferences().size() == 2);
+ IPreference pref1 = widget.getPreferences().get(0);
+ IPreference pref2 = widget.getPreferences().get(1);
assertEquals("a", pref1.getName());
assertEquals("a", pref1.getValue());
@@ -852,8 +844,8 @@ public class PackagingAndConfiguration e
@Test
public void bc(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-DwhJBIJRQN/007/bc.wgt");
- assertTrue(widget.getPrefences().size() == 1);
- IPreferenceEntity pref = widget.getPrefences().get(0);
+ assertTrue(widget.getPreferences().size() == 1);
+ IPreference pref = widget.getPreferences().get(0);
assertEquals("PASS",pref.getName());
assertEquals("PASS", pref.getValue());
assertEquals(false, pref.isReadOnly());
@@ -862,24 +854,24 @@ public class PackagingAndConfiguration e
@Ignore
public void bd(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-DwhJBIJRQN/008/bd.wgt");
- assertTrue(widget.getPrefences().size() == 1);
- IPreferenceEntity pref = widget.getPrefences().get(0);
+ assertTrue(widget.getPreferences().size() == 1);
+ IPreference pref = widget.getPreferences().get(0);
assertEquals(false, pref.isReadOnly());
}
@Test
@Ignore
public void be(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-DwhJBIJRQN/009/be.wgt");
- assertTrue(widget.getPrefences().size() == 1);
- IPreferenceEntity pref = widget.getPrefences().get(0);
+ assertTrue(widget.getPreferences().size() == 1);
+ IPreference pref = widget.getPreferences().get(0);
assertEquals(false, pref.isReadOnly());
}
@Test
@Ignore
public void bf(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-DwhJBIJRQN/010/bf.wgt");
- assertTrue(widget.getPrefences().size() == 1);
- IPreferenceEntity pref = widget.getPrefences().get(0);
+ assertTrue(widget.getPreferences().size() == 1);
+ IPreference pref = widget.getPreferences().get(0);
assertEquals(false, pref.isReadOnly());
}
@@ -1014,8 +1006,8 @@ public class PackagingAndConfiguration e
public void ha(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-rZdcMBExBX/002/ha.wgt");
assertEquals(2,widget.getFeatures().size());
- IFeatureEntity feature1 = widget.getFeatures().get(0);
- IFeatureEntity feature2 = widget.getFeatures().get(1);
+ IFeature feature1 = widget.getFeatures().get(0);
+ IFeature feature2 = widget.getFeatures().get(1);
assertEquals("feature:a9bb79c1", feature1.getName());
assertEquals("feature:a9bb79c1", feature2.getName());
assertEquals(1,feature1.getParameters().size());
@@ -1073,11 +1065,11 @@ public class PackagingAndConfiguration e
public void v9(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-EGkPfzCBOz/002/v9.wgt");
assertEquals(1,widget.getFeatures().size());
- IFeatureEntity feature1 = widget.getFeatures().get(0);
+ IFeature feature1 = widget.getFeatures().get(0);
assertEquals("feature:a9bb79c1", feature1.getName());
assertEquals(2,feature1.getParameters().size());
- IParamEntity param1 = feature1.getParameters().get(0);
- IParamEntity param2 = feature1.getParameters().get(1);
+ IParam param1 = feature1.getParameters().get(0);
+ IParam param2 = feature1.getParameters().get(1);
assertEquals("PASS",param1.getName());
assertEquals("PASS",param2.getName());
assertTrue(
@@ -1197,7 +1189,7 @@ public class PackagingAndConfiguration e
@Test
public void bl(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-FAFYMEGELU/002/bl.wgt");
- List<IIconEntity> icons = widget.getIconsList();
+ List<IIcon> icons = widget.getIcons();
assertTrue(icons.size() == 2);
String icon1 = getLocalIconPath(widget,0);
String icon2 = getLocalIconPath(widget,1);
@@ -1207,7 +1199,7 @@ public class PackagingAndConfiguration e
@Test
public void bm(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-FAFYMEGELU/003/bm.wgt");
- List<IIconEntity> icons = widget.getIconsList();
+ List<IIcon> icons = widget.getIcons();
assertEquals(2,icons.size());
String icon1 = getLocalIconPath(widget,0);
String icon2 = getLocalIconPath(widget,1);
@@ -1218,7 +1210,7 @@ public class PackagingAndConfiguration e
@Test
public void bn(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-FAFYMEGELU/004/bn.wgt");
- List<IIconEntity> icons = widget.getIconsList();
+ List<IIcon> icons = widget.getIcons();
assertTrue(icons.size() == 2);
String icon1 = getLocalIconPath(widget,0);
String icon2 = getLocalIconPath(widget,1);
@@ -1228,7 +1220,7 @@ public class PackagingAndConfiguration e
@Test
public void bo(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-FAFYMEGELU/005/bo.wgt");
- List<IIconEntity> icons = widget.getIconsList();
+ List<IIcon> icons = widget.getIcons();
assertTrue(icons.size() == 2);
String icon1 = getLocalIconPath(widget,0);
String icon2 = getLocalIconPath(widget,1);
@@ -1238,7 +1230,7 @@ public class PackagingAndConfiguration e
@Test
public void bp(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-FAFYMEGELU/006/bp.wgt");
- List<IIconEntity> iconList = widget.getIconsList();
+ List<IIcon> iconList = widget.getIcons();
assertTrue(iconList.size() == 2);
String icons = getLocalIconPath(widget,0) + " " + getLocalIconPath(widget,1);
assertTrue(icons.equals("icon.png locales/en/icon.png")||icons.equals("locales/en/icon.png icon.png"));
@@ -1272,9 +1264,9 @@ public class PackagingAndConfiguration e
// Utility methods
- private ILicenseEntity getLicense(W3CWidget widget){
- ILicenseEntity[] descs = widget.getLicensesList().toArray(new ILicenseEntity[widget.getLicensesList().size()]);
- return (ILicenseEntity) LocalizationUtils.getLocalizedElement(descs, null, widget.getDefaultLocale());
+ private ILicense getLicense(W3CWidget widget){
+ ILicense[] descs = widget.getLicenses().toArray(new ILicense[widget.getLicenses().size()]);
+ return (ILicense) LocalizationUtils.getLocalizedElement(descs, null, widget.getDefaultLocale());
}
private String getLicenseText(W3CWidget widget){
@@ -1286,27 +1278,28 @@ public class PackagingAndConfiguration e
}
private String getDescription(W3CWidget widget){
- IDescriptionEntity[] descs = widget.getDescriptions().toArray(new IDescriptionEntity[widget.getDescriptions().size()]);
- IDescriptionEntity desc = (IDescriptionEntity) LocalizationUtils.getLocalizedElement(descs, null, widget.getDefaultLocale());
+ IDescription[] descs = widget.getDescriptions().toArray(new IDescription[widget.getDescriptions().size()]);
+ IDescription desc = (IDescription) LocalizationUtils.getLocalizedElement(descs, null, widget.getDefaultLocale());
return desc.getDescription();
}
- private String getName(W3CWidget widget){
- return getNameEntity(widget).getName();
+ private String getShortName(W3CWidget widget){
+ if (widget.getNames().size() == 0) return null;
+ return getNameObject(widget).getShort();
}
- private String getShortName(W3CWidget widget){
+ private String getName(W3CWidget widget){
if (widget.getNames().size() == 0) return null;
- return getNameEntity(widget).getShort();
+ return getNameObject(widget).getName();
}
- private INameEntity getNameEntity(W3CWidget widget){
- INameEntity[] names = widget.getNames().toArray(new INameEntity[widget.getNames().size()]);
- return (INameEntity) LocalizationUtils.getLocalizedElement(names, null, widget.getDefaultLocale());
+ private IName getNameObject(W3CWidget widget){
+ IName[] names = widget.getNames().toArray(new IName[widget.getNames().size()]);
+ return ((IName) LocalizationUtils.getLocalizedElement(names, null, widget.getDefaultLocale()));
}
private String getSrc(W3CWidget widget){
- IContentEntity startFile = getDefaultStartFile(widget);
+ IContent startFile = getDefaultStartFile(widget);
String start = startFile.getSrc();
return getLocalUrl(start);
}
@@ -1319,22 +1312,22 @@ public class PackagingAndConfiguration e
return getDefaultStartFile(widget).getType();
}
- private IContentEntity getDefaultStartFile(W3CWidget widget){
- IContentEntity[] contents = widget.getContentList().toArray(new IContentEntity[widget.getContentList().size()]);
- return (IContentEntity) LocalizationUtils.getLocalizedElement(contents, null, widget.getDefaultLocale());
+ private IContent getDefaultStartFile(W3CWidget widget){
+ IContent[] contents = widget.getContentList().toArray(new IContent[widget.getContentList().size()]);
+ return (IContent) LocalizationUtils.getLocalizedElement(contents, null, widget.getDefaultLocale());
}
- private IIconEntity getIconEntity(W3CWidget widget){
- IIconEntity[] icons = widget.getIconsList().toArray(new IIconEntity[widget.getIconsList().size()]);
- return (IIconEntity) LocalizationUtils.getLocalizedElement(icons, null, widget.getDefaultLocale());
+ private String getIcon(W3CWidget widget){
+ return getLocalUrl(getIconObject(widget).getSrc());
}
- private String getIcon(W3CWidget widget){
- return getLocalUrl(getIconEntity(widget).getSrc());
+ private IIcon getIconObject(W3CWidget widget){
+ IIcon[] icons = widget.getIcons().toArray(new IIcon[widget.getIcons().size()]);
+ return (IIcon) LocalizationUtils.getLocalizedElement(icons, null, widget.getDefaultLocale());
}
private String getLocalIconPath(W3CWidget widget, int index){
- return getLocalUrl(widget.getIconsList().get(index).getSrc());
+ return getLocalUrl(widget.getIcons().get(index).getSrc());
}
private String getLocalUrl(String src){
@@ -1358,8 +1351,8 @@ public class PackagingAndConfiguration e
return src;
}
- private IFeatureEntity getTestFeature(W3CWidget widget){
- for (IFeatureEntity feature:widget.getFeatures()){
+ private IFeature getTestFeature(W3CWidget widget){
+ for (IFeature feature:widget.getFeatures()){
if (feature.getName().equals("feature:a9bb79c1")) return feature;
}
return null;
Modified: incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/UpdateConformanceTest.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/UpdateConformanceTest.java?rev=1349299&r1=1349298&r2=1349299&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/UpdateConformanceTest.java (original)
+++ incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/UpdateConformanceTest.java Tue Jun 12 12:38:28 2012
@@ -22,11 +22,11 @@ import static org.junit.Assert.assertTru
import java.io.File;
import java.io.IOException;
-import org.apache.wookie.w3c.W3CWidget;
import org.apache.wookie.w3c.W3CWidgetFactory;
import org.apache.wookie.w3c.updates.InvalidUDDException;
import org.apache.wookie.w3c.updates.UpdateDescriptionDocument;
import org.apache.wookie.w3c.updates.UpdateUtils;
+import org.apache.wookie.w3c.W3CWidget;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
@@ -61,7 +61,7 @@ public class UpdateConformanceTest exten
@Test
public void pr001(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-preparation1/001/ta-pr-001.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdateLocation());
}
@Test
@@ -74,14 +74,14 @@ public class UpdateConformanceTest exten
@Test
public void pr003(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-preparation1/003/ta-pr-003.wgt");
- assertNull(widget.getUpdate());
+ assertNull(widget.getUpdateLocation());
}
@Test
public void pr004(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-preparation1/004/ta-pr-004.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdateLocation());
}
@Ignore
@@ -99,54 +99,54 @@ public class UpdateConformanceTest exten
@Test
public void pr007(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-preparation1/007/ta-pr-007.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdateLocation());
}
// Error in test
@Test
public void pr008(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-preparation1/008/ta-pr-008.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdateLocation());
assertNotNull(UpdateUtils.checkForUpdate(widget));
}
@Test
public void pr009(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-preparation1/009/ta-pr-009.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdateLocation());
assertNotNull(UpdateUtils.checkForUpdate(widget));
}
@Test
public void pr010(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-preparation1/010/ta-pr-010.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdateLocation());
assertNotNull(UpdateUtils.checkForUpdate(widget));
}
@Test
public void pr011(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-preparation1/011/ta-pr-011.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdateLocation());
}
@Test
public void pr012(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-preparation1/012/ta-pr-012.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdateLocation());
}
@Test
public void pr013(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-preparation1/013/ta-pr-013.wgt");
- assertEquals(null, widget.getUpdate());
+ assertEquals(null, widget.getUpdateLocation());
assertNull(UpdateUtils.checkForUpdate(widget));
}
@Test
public void pr014(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-preparation1/014/ta-pr-014.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdateLocation());
assertNotNull(UpdateUtils.checkForUpdate(widget));
}
@@ -157,77 +157,77 @@ public class UpdateConformanceTest exten
@Test
public void ac1(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition1/001/ta-ac-001.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-if-none-match", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-if-none-match", widget.getUpdateLocation());
}
// Requires runtime testing
@Test
public void ac2(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition2/001/ta-ac-001.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-if-modified-since", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-if-modified-since", widget.getUpdateLocation());
}
// Requires runtime testing
@Test
public void ac3(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition3/001/ta-ac-001.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-accept-language", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-accept-language", widget.getUpdateLocation());
}
// Requires runtime testing
@Test
public void ac4(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition4/001/ta-ac-001.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-cache-control=must-revalidate", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-cache-control=must-revalidate", widget.getUpdateLocation());
widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition4/002/ta-ac-002.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-cache-control=no-cache", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-cache-control=no-cache", widget.getUpdateLocation());
widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition4/003/ta-ac-003.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pragma=no-cache", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pragma=no-cache", widget.getUpdateLocation());
}
// Requires runtime testing
@Test
public void ac5(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition5/001/ta-ac-001.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-expires-in=300", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-expires-in=300", widget.getUpdateLocation());
}
@Test
public void ac6() throws InvalidUDDException{
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition6/001/ta-ac-001.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-pass", widget.getUpdateLocation());
assertNotNull(UpdateUtils.checkForUpdate(widget));
}
@Test
public void ac7() throws InvalidUDDException{
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition7/001/ta-ac-001.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-wrong-ct", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-wrong-ct", widget.getUpdateLocation());
assertNull(UpdateUtils.checkForUpdate(widget));
}
@Test
public void ac81() throws InvalidUDDException{
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition8/001/ta-ac-001.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-204", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-204", widget.getUpdateLocation());
assertNull(UpdateUtils.checkForUpdate(widget));
}
@Test
public void ac82() throws InvalidUDDException{
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition8/002/ta-ac-002.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-304", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-304", widget.getUpdateLocation());
assertNull(UpdateUtils.checkForUpdate(widget));
}
@Test
public void ac83() throws InvalidUDDException{
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition8/003/ta-ac-003.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-udi-204", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-udi-204", widget.getUpdateLocation());
assertNull(UpdateUtils.getUpdate(fac, widget));
}
@Test
public void ac9() throws InvalidUDDException{
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition9/001/ta-ac-001.wgt");
- assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-206", widget.getUpdate());
+ assertEquals("http://people.opera.com/harig/wupdres/resources/out.php?udd-206", widget.getUpdateLocation());
assertNull(UpdateUtils.checkForUpdate(widget));
}
@@ -235,14 +235,14 @@ public class UpdateConformanceTest exten
public void ac101() throws InvalidUDDException{
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition10/001/ta-ac-001.wgt");
@SuppressWarnings("unused")
- UpdateDescriptionDocument udd = new UpdateDescriptionDocument(widget.getUpdate());
+ UpdateDescriptionDocument udd = new UpdateDescriptionDocument(widget.getUpdateLocation());
}
@Test
public void ac102() throws InvalidUDDException{
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition10/002/ta-ac-002.wgt");
@SuppressWarnings("unused")
- UpdateDescriptionDocument udd = new UpdateDescriptionDocument(widget.getUpdate());
+ UpdateDescriptionDocument udd = new UpdateDescriptionDocument(widget.getUpdateLocation());
}
@Test
@@ -274,7 +274,7 @@ public class UpdateConformanceTest exten
public void ac13() throws InvalidUDDException{
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-acquisition13/001/ta-ac-001.wgt");
@SuppressWarnings("unused")
- UpdateDescriptionDocument udd = new UpdateDescriptionDocument(widget.getUpdate());
+ UpdateDescriptionDocument udd = new UpdateDescriptionDocument(widget.getUpdateLocation());
}
/**
@@ -284,20 +284,20 @@ public class UpdateConformanceTest exten
@Test
public void pr1(){
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-processing1/001/ta-pr-001.wgt");
- assertNull(widget.getUpdate());
+ assertNull(widget.getUpdateLocation());
}
@Test(expected=InvalidUDDException.class)
public void pr201() throws InvalidUDDException{
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-processing2/001/ta-pr-001.wgt");
@SuppressWarnings("unused")
- UpdateDescriptionDocument udd = new UpdateDescriptionDocument(widget.getUpdate());
+ UpdateDescriptionDocument udd = new UpdateDescriptionDocument(widget.getUpdateLocation());
}
@Test(expected=InvalidUDDException.class)
public void pr202() throws InvalidUDDException{
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-processing2/002/ta-pr-002.wgt");
@SuppressWarnings("unused")
- UpdateDescriptionDocument udd = new UpdateDescriptionDocument(widget.getUpdate());
+ UpdateDescriptionDocument udd = new UpdateDescriptionDocument(widget.getUpdateLocation());
}
//TODO Requires runtime testing as the update changes the widget ID
@@ -409,7 +409,7 @@ public class UpdateConformanceTest exten
@Test
public void pr220() throws InvalidUDDException{
W3CWidget widget = processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets-updates/test-suite/test-cases/ta-processing2/020/ta-pr-020.wgt");
- UpdateDescriptionDocument udd = new UpdateDescriptionDocument(widget.getUpdate());
+ UpdateDescriptionDocument udd = new UpdateDescriptionDocument(widget.getUpdateLocation());
assertEquals("P A S S", udd.getDetails("en"));
}
Modified: incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/UpdateUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/UpdateUtilsTest.java?rev=1349299&r1=1349298&r2=1349299&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/UpdateUtilsTest.java (original)
+++ incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/UpdateUtilsTest.java Tue Jun 12 12:38:28 2012
@@ -21,12 +21,12 @@ import static org.junit.Assert.assertNul
import java.io.IOException;
-import org.apache.wookie.w3c.W3CWidget;
import org.apache.wookie.w3c.W3CWidgetFactory;
import org.apache.wookie.w3c.exceptions.BadManifestException;
import org.apache.wookie.w3c.exceptions.BadWidgetZipFileException;
import org.apache.wookie.w3c.exceptions.InvalidContentTypeException;
import org.apache.wookie.w3c.updates.UpdateUtils;
+import org.apache.wookie.w3c.W3CWidget;
import org.junit.Test;
/**
Modified: incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/WidgetOutputterTest.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/WidgetOutputterTest.java?rev=1349299&r1=1349298&r2=1349299&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/WidgetOutputterTest.java (original)
+++ incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/WidgetOutputterTest.java Tue Jun 12 12:38:28 2012
@@ -21,14 +21,14 @@ import java.io.File;
import java.io.FileOutputStream;
import java.net.URL;
-import org.apache.wookie.w3c.INameEntity;
-import org.apache.wookie.w3c.W3CWidget;
+import org.apache.wookie.w3c.IName;
import org.apache.wookie.w3c.W3CWidgetFactory;
import org.apache.wookie.w3c.exceptions.BadManifestException;
import org.apache.wookie.w3c.exceptions.BadWidgetZipFileException;
import org.apache.wookie.w3c.impl.IconEntity;
import org.apache.wookie.w3c.util.WidgetOutputter;
import org.apache.wookie.w3c.util.WidgetPackageUtils;
+import org.apache.wookie.w3c.W3CWidget;
import org.junit.Test;
/**
@@ -81,7 +81,7 @@ public class WidgetOutputterTest extends
public void outputString5() throws Exception{
File testWidget = new File("build/widgets/localetest.wgt");
W3CWidget widget = load(testWidget);
- widget.getIconsList().add(new IconEntity("icon.png",100,100));
+ widget.getIcons().add(new IconEntity("icon.png",100,100));
widget.getNames().get(0).setShort("shortName");
WidgetOutputter outputter = new WidgetOutputter();
outputter.setWidgetFolder("/widgets");
@@ -111,7 +111,7 @@ public class WidgetOutputterTest extends
public void loadModifySave() throws Exception{
File testWidget = new File("build/widgets/bubbles.wgt");
W3CWidget widget = load(testWidget);
- INameEntity name = widget.getNames().get(0);
+ IName name = widget.getNames().get(0);
name.setName("Modified Widget");
WidgetOutputter outputter = new WidgetOutputter();
outputter.setWidgetFolder("/widgets");
@@ -134,7 +134,7 @@ public class WidgetOutputterTest extends
fac.setOutputDirectory(output.getAbsolutePath());
W3CWidget widget = fac.parse(new URL("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-RRZxvvTFHx/001/b6.wgt"));
- INameEntity name = widget.getNames().get(0);
+ IName name = widget.getNames().get(0);
name.setName("Re-Modified Widget");
WidgetOutputter outputter = new WidgetOutputter();
outputter.setWidgetFolder("/widgets");
Modified: incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/i18nManual.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/i18nManual.java?rev=1349299&r1=1349298&r2=1349299&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/i18nManual.java (original)
+++ incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/i18nManual.java Tue Jun 12 12:38:28 2012
@@ -16,11 +16,7 @@ package org.apache.wookie.w3c.test;
import java.net.MalformedURLException;
import java.net.URL;
-import org.apache.wookie.w3c.IAuthorEntity;
-import org.apache.wookie.w3c.IDescriptionEntity;
-import org.apache.wookie.w3c.ILicenseEntity;
-import org.apache.wookie.w3c.INameEntity;
-import org.apache.wookie.w3c.W3CWidget;
+import org.apache.wookie.w3c.*;
import org.apache.wookie.w3c.util.FormattingUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -67,7 +63,7 @@ public class i18nManual extends Conforma
@Test
public void nameLro(){
W3CWidget widget;
- INameEntity name;
+ IName name;
widget = getWidget("001","lro");
name = widget.getNames().get(0);
@@ -105,7 +101,7 @@ public class i18nManual extends Conforma
public void nameLtr(){
String dir ="ltr";
W3CWidget widget;
- INameEntity name;
+ IName name;
widget = getWidget("001",dir);
name = widget.getNames().get(0);
@@ -143,7 +139,7 @@ public class i18nManual extends Conforma
public void nameRlo(){
String dir ="rlo";
W3CWidget widget;
- INameEntity name;
+ IName name;
widget = getWidget("001",dir);
name = widget.getNames().get(0);
@@ -180,7 +176,7 @@ public class i18nManual extends Conforma
public void nameRtl(){
String dir ="rtl";
W3CWidget widget;
- INameEntity name;
+ IName name;
widget = getWidget("001",dir);
name = widget.getNames().get(0);
@@ -220,7 +216,7 @@ public class i18nManual extends Conforma
public void descriptions(){
W3CWidget widget;
- IDescriptionEntity description;
+ IDescription description;
String dir;
String test;
@@ -319,80 +315,80 @@ public class i18nManual extends Conforma
public void licenses(){
W3CWidget widget;
- ILicenseEntity license;
+ ILicense license;
String dir;
String test;
dir="lro";
test="005";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "×פ××××§");
test="009";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "×פ××××§");
test="013";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "×פ××××§");
test="018";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "×פ××××§");
dir="ltr";
test="005";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "The arrow should point right -->");
test="009";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "The arrow should point right -->");
test="013";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "The arrow should point right -->");
test="018";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "The arrow should point right -->");
dir="rlo";
test="005";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "PASSED");
test="009";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "PASSED");
test="013";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "PASSED");
test="018";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "PASSED");
dir="rtl";
test="005";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "The arrow should point right -->");
test="009";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "The arrow should point right -->");
test="013";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "The arrow should point right -->");
test="018";
widget = getWidget(test,dir);
- license = widget.getLicensesList().get(0);
+ license = widget.getLicenses().get(0);
addResult("i18n"+dir+test, FormattingUtils.getFormattedWidgetLicense(license), "The arrow should point right -->");
}
@@ -404,7 +400,7 @@ public class i18nManual extends Conforma
W3CWidget widget;
String dir;
String test;
- IAuthorEntity author;
+ IAuthor author;
dir="lro";
test="004";
@@ -542,7 +538,7 @@ public class i18nManual extends Conforma
return widget;
}
protected String getLocalIconPath(W3CWidget widget, int index){
- return getLocalUrl(widget.getIconsList().get(index).getSrc());
+ return getLocalUrl(widget.getIcons().get(index).getSrc());
}
protected String getLocalUrl(String src){
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAccess.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAccess.java?rev=1349299&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAccess.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAccess.java Tue Jun 12 12:38:28 2012
@@ -0,0 +1,29 @@
+/*
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.wookie.w3c;
+
+/**
+ * a Widget Access Request Policy (WARP) element
+ */
+public interface IAccess {
+
+ public String getOrigin();
+
+ public boolean hasSubDomains();
+
+}
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAuthor.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAuthor.java?rev=1349299&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAuthor.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IAuthor.java Tue Jun 12 12:38:28 2012
@@ -0,0 +1,62 @@
+/*
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.wookie.w3c;
+
+/**
+ * An Author of a Widget
+ */
+public interface IAuthor extends ILocalized, IDirectional {
+
+ /**
+ * Get the details of the author, e.g. name or names of people and/or organisations
+ * @return the author details, or null if there are no author details
+ */
+ public String getAuthorName();
+
+ /**
+ * Get the email address of the author
+ * @return the author email address, or null if there is no author email address
+ */
+ public String getEmail();
+
+ /**
+ * Get the URL of the author details, e.g. the author's blog or website address
+ * @return the author's URL, or null if there is no author URL
+ */
+ public String getHref();
+
+ /**
+ * Set the author details
+ * @param author tha author details to set
+ */
+ public void setAuthorName(String author);
+
+ /**
+ * Set the author's email
+ * @param email the author email to set
+ */
+ public void setEmail(String email);
+
+ /**
+ * Set the author's Href
+ * @param href the author href to set
+ */
+ public void setHref(String href);
+
+
+}
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IContent.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IContent.java?rev=1349299&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IContent.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IContent.java Tue Jun 12 12:38:28 2012
@@ -0,0 +1,38 @@
+/*
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.wookie.w3c;
+
+
+/**
+ * A content page (start file) for a widget
+ */
+public interface IContent extends ILocalized, IDirectional {
+
+ public String getSrc();
+
+ public void setSrc(String src);
+
+ public String getCharSet();
+
+ public void setCharSet(String charSet);
+
+ public String getType();
+
+ public void setType(String type);
+
+}
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDescription.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDescription.java?rev=1349299&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDescription.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDescription.java Tue Jun 12 12:38:28 2012
@@ -0,0 +1,39 @@
+/*
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.wookie.w3c;
+
+/**
+ * A Description of a Widget
+ */
+public interface IDescription extends ILocalized, IDirectional {
+
+ /**
+ * Get widget description content.
+ *
+ * @return content
+ */
+ String getDescription();
+
+ /**
+ * Set widget description content.
+ *
+ * @param text content
+ */
+ void setDescription(String text);
+
+}
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDirectional.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDirectional.java?rev=1349299&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDirectional.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IDirectional.java Tue Jun 12 12:38:28 2012
@@ -0,0 +1,45 @@
+/*
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.wookie.w3c;
+
+/**
+ * An object that uses text direction
+ */
+public interface IDirectional {
+
+ /**
+ * Get the direction of text, which can be one of "ltr", "rtl", "lro", or "rlo". The default value is "ltr".
+ * @return the direction of the text
+ */
+ public String getDir();
+
+ /**
+ * Set the direction of text, which can be one of "ltr", "rtl", "lro", or "rlo". The default value is "ltr".
+ * @param dir the direction to set
+ */
+ public void setDir(String dir);
+
+ /**
+ * Checks whether this object has valid localization settings; specifically that the lang property of this
+ * object is a valid language-tag according to BCP-47
+ * @return true if the locale for this object is aeither valid language tag or null, otherwise false.
+ */
+ public boolean isValid();
+
+
+}
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IFeature.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IFeature.java?rev=1349299&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IFeature.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IFeature.java Tue Jun 12 12:38:28 2012
@@ -0,0 +1,69 @@
+/*
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.wookie.w3c;
+
+import java.util.List;
+
+/**
+ * A Feature required or used by a Widget
+ */
+public interface IFeature {
+
+ /**
+ * Get widget feature name.
+ *
+ * @return feature name
+ */
+ String getName();
+
+ /**
+ * Set widget feature name.
+ *
+ * @param featureName feature name
+ */
+ void setName(String featureName);
+
+ /**
+ * Get widget feature required flag.
+ *
+ * @return required flag
+ */
+ boolean isRequired();
+
+ /**
+ * Set widget feature required flag.
+ *
+ * @param required required flag
+ */
+ void setRequired(boolean required);
+
+ /**
+ * Get collection of widget feature parameters.
+ *
+ * @return parameters collection
+ */
+ List<IParam> getParameters();
+
+ /**
+ * Set collection of widget feature parameters.
+ *
+ * @param parameters parameters collection
+ */
+ void setParameters(List<IParam> parameters);
+
+}
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IIcon.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IIcon.java?rev=1349299&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IIcon.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/IIcon.java Tue Jun 12 12:38:28 2012
@@ -0,0 +1,67 @@
+/*
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.wookie.w3c;
+
+/**
+ * An Icon for a Widget
+ */
+public interface IIcon extends ILocalized {
+
+ /**
+ * Get widget icon source URL.
+ *
+ * @return icon source URL
+ */
+ String getSrc();
+
+ /**
+ * Set widget icon source URL.
+ *
+ * @param src icon source URL
+ */
+ void setSrc(String src);
+
+ /**
+ * Get widget icon height.
+ *
+ * @return icon height
+ */
+ Integer getHeight();
+
+ /**
+ * Set widget icon height.
+ *
+ * @param height icon height
+ */
+ void setHeight(Integer height);
+
+ /**
+ * Get widget icon width.
+ *
+ * @return icon width
+ */
+ Integer getWidth();
+
+ /**
+ * Set widget icon width.
+ *
+ * @param width icon width
+ */
+ void setWidth(Integer width);
+
+}
Added: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILicense.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILicense.java?rev=1349299&view=auto
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILicense.java (added)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/ILicense.java Tue Jun 12 12:38:28 2012
@@ -0,0 +1,54 @@
+/*
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.wookie.w3c;
+
+
+/**
+ * A License for a Widget
+ */
+public interface ILicense extends ILocalized, IDirectional {
+
+ /**
+ * Get widget license text.
+ *
+ * @return license text
+ */
+ String getLicenseText();
+
+ /**
+ * Set widget license text.
+ *
+ * @param text license text
+ */
+ void setLicenseText(String text);
+
+ /**
+ * Get widget license href URL.
+ *
+ * @return href URL
+ */
+ String getHref();
+
+ /**
+ * Set widget license href URL.
+ *
+ * @param href href URL
+ */
+ void setHref(String href);
+
+}