Author: scottbw
Date: Wed Mar  7 22:38:51 2012
New Revision: 1298179

URL: http://svn.apache.org/viewvc?rev=1298179&view=rev
Log:
Made changes to the /widgets API XML representation as described in WOOKIE-327, 
and updated related test cases. Also added a note in UPGRADING about requiring 
a 0.10 connector to work with a 0.10 server.

Modified:
    incubator/wookie/trunk/UPGRADING
    
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/conformance/AbstractFunctionalConformanceTest.java
    
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/conformance/PackagingAndConfiguration.java
    
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetsControllerTest.java
    incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetHelper.java

Modified: incubator/wookie/trunk/UPGRADING
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/UPGRADING?rev=1298179&r1=1298178&r2=1298179&view=diff
==============================================================================
--- incubator/wookie/trunk/UPGRADING (original)
+++ incubator/wookie/trunk/UPGRADING Wed Mar  7 22:38:51 2012
@@ -1,6 +1,17 @@
 This document details any special actions that need to be taken when upgrading 
Wookie from a previous version. For
 general information on new features and improvements, see NEW_AND_NOTEWORTHY.
 
+FROM 0.9.2 TO 0.10.0
+====================
+
+There are a number of API changes in 0.10.0, in particular the XML 
representation used for Widgets returned by the
+REST API has been changed to follow more closely the W3C Widget XML format. 
This affects any plugins or connectors 
+that browse the Wookie widget catalog by calling GET /widgets. The connector 
frameworks have been updated for this
+release and so you should make sure you use a 0.10.0 connector with a 0.10.0 
server.
+
+The Services class and related classes deprecated in earlier versions of 
Wookie were removed in 0.10.0, and these
+tables can be removed from the database. There is a script in 
/scripts/migration to drop these tables.
+
 FROM 0.9.1 TO 0.9.2
 ===================
 

Modified: 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/conformance/AbstractFunctionalConformanceTest.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src-tests/org/apache/wookie/tests/conformance/AbstractFunctionalConformanceTest.java?rev=1298179&r1=1298178&r2=1298179&view=diff
==============================================================================
--- 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/conformance/AbstractFunctionalConformanceTest.java
 (original)
+++ 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/conformance/AbstractFunctionalConformanceTest.java
 Wed Mar  7 22:38:51 2012
@@ -106,7 +106,7 @@ AbstractControllerTest {
         * @return the id of the widget instance that was created
         */
        protected static String instantiateWidget(Element widget){
-               return 
instantiateWidget(widget.getAttributeValue("identifier"));       
+               return instantiateWidget(widget.getAttributeValue("id"));       
        }
 
        /**

Modified: 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/conformance/PackagingAndConfiguration.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src-tests/org/apache/wookie/tests/conformance/PackagingAndConfiguration.java?rev=1298179&r1=1298178&r2=1298179&view=diff
==============================================================================
--- 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/conformance/PackagingAndConfiguration.java
 (original)
+++ 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/conformance/PackagingAndConfiguration.java
 Wed Mar  7 22:38:51 2012
@@ -121,7 +121,7 @@ public class PackagingAndConfiguration e
                assertEquals("", widget.getChild("author").getText());
                // feature list must be empty (null)
                /// Check manually
-               System.out.println("Manual 
test:"+widget.getAttributeValue("identifier")+": feature list must be empty ");
+               System.out.println("Manual 
test:"+widget.getAttributeValue("id")+": feature list must be empty ");
                // icons must be null, 
                assertEquals(null, widget.getChild("icon"));
                // start file encoding must be UTF-8, 
@@ -135,14 +135,14 @@ public class PackagingAndConfiguration e
                assertEquals("", getWidgetHeight(widget));
                // widget id must be null, 
                /// We have to use generated ids - no nulls allowed
-               
assertTrue(widget.getAttributeValue("identifier").contains("generated"));
+               
assertTrue(widget.getAttributeValue("id").contains("generated"));
                // widget license must be null, 
                // widget license file must be null, 
                // widget license href must be null, 
                assertEquals(null, widget.getChild("license"));
                // widget name must be null, 
                /// We put a default of "unknown" when exporting this when the 
value is "null"
-               assertEquals("", getWidgetTitle(widget));
+               assertEquals("", getWidgetname(widget));
                // widget preferences must be null, 
                assertEquals(null, widget.getChild("license"));
                // widget short name must be null, 
@@ -231,20 +231,20 @@ public class PackagingAndConfiguration e
        @Test
        public void b1(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-RawAIWHoMs/000/b1.wgt";);
-               assertEquals("pass:", widget.getAttributeValue("identifier"));
+               assertEquals("pass:", widget.getAttributeValue("id"));
        }
        @Test
        public void rd(){
                // We can't allow null ids, we use generated IDs where they 
aren't valid
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-RawAIWHoMs/001/rd.wgt";);
-               
assertTrue(widget.getAttributeValue("identifier").contains("generated"));
+               
assertTrue(widget.getAttributeValue("id").contains("generated"));
        }
        
        @Ignore // Note that this test will pass on its own, but not if run in 
a series including b1, as it will update b1 rather than create a new widget");
        @Test
        public void b2(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-RawAIWHoMs/002/b2.wgt";);
-               assertEquals("pass:", widget.getAttributeValue("identifier")); 
+               assertEquals("pass:", widget.getAttributeValue("id")); 
        }
 
        // 11 Version
@@ -351,44 +351,44 @@ public class PackagingAndConfiguration e
                assertEquals("index.htm",start);
        }
 
-       // 15 Title
+       // 15 name
 
        @Test
        public void bx(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-LYLMhryBBT/000/bx.wgt";);
-               assertEquals("PASS", getWidgetTitle(widget));
+               assertEquals("PASS", getWidgetname(widget));
        }
 
        @Test
        public void by(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-LYLMhryBBT/001/by.wgt";);
-               assertEquals("", getWidgetTitle(widget));
+               assertEquals("", getWidgetname(widget));
        }
 
        @Test
        public void bz(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-LYLMhryBBT/002/bz.wgt";);
-               assertEquals("PASS", getWidgetTitle(widget));
+               assertEquals("PASS", getWidgetname(widget));
        }
 
-       // 16 Title
+       // 16 name
 
        @Test
        public void ao(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-AYLMhryBnD/000/ao.wgt";);
-               assertEquals("PASS", getWidgetTitle(widget));
+               assertEquals("PASS", getWidgetname(widget));
        }
 
        @Test
        public void ap(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-AYLMhryBnD/001/ap.wgt";);
-               assertEquals("P A S S", getWidgetTitle(widget));
+               assertEquals("P A S S", getWidgetname(widget));
        }
 
        @Test
        public void aq(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-AYLMhryBnD/002/aq.wgt";);
-               assertEquals("PASS", getWidgetTitle(widget));
+               assertEquals("PASS", getWidgetname(widget));
        }
 
        @Test
@@ -400,14 +400,14 @@ public class PackagingAndConfiguration e
        @Test
        public void as(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-AYLMhryBnD/004/as.wgt";);
-               assertEquals("PASS", getWidgetTitle(widget));
+               assertEquals("PASS", getWidgetname(widget));
                assertEquals("PASS", getWidgetShortName(widget));
        }
 
        @Test
        public void at(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-AYLMhryBnD/005/at.wgt";);
-               assertEquals("PASS", getWidgetTitle(widget));
+               assertEquals("PASS", getWidgetname(widget));
                assertEquals("PASS", getWidgetShortName(widget));
        }
 
@@ -420,13 +420,13 @@ public class PackagingAndConfiguration e
        @Test
        public void av(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-AYLMhryBnD/007/av.wgt";);
-               assertEquals("", getWidgetTitle(widget));
+               assertEquals("", getWidgetname(widget));
        }
 
        @Test
        public void oa(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-AYLMhryBnD/008/oa.wgt";);
-               assertEquals("PASS", getWidgetTitle(widget));
+               assertEquals("PASS", getWidgetname(widget));
        }
 
        // 17 Description
@@ -890,14 +890,14 @@ public class PackagingAndConfiguration e
        public void e5(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-dPOgiLQKNK/001/e5.wgt";);
                //assertEquals("ISO-8859-1",getStartFileEncoding(widget));
-               System.out.println("Manual test: charset for start file of 
"+widget.getAttributeValue("identifier")+" must be ISO-8859-1");
+               System.out.println("Manual test: charset for start file of 
"+widget.getAttributeValue("id")+" must be ISO-8859-1");
        }
        @Test
        // We don't support non-UTF-8 encodings, so this requires a manual test
        public void e6(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-dPOgiLQKNK/002/e6.wgt";);
                //assertEquals("ISO-8859-1",getStartFileEncoding(widget));
-               System.out.println("Manual test: charset for start file of 
"+widget.getAttributeValue("identifier")+" must be ISO-8859-1");
+               System.out.println("Manual test: charset for start file of 
"+widget.getAttributeValue("id")+" must be ISO-8859-1");
        }
        @Test
        public void e7(){
@@ -927,7 +927,7 @@ public class PackagingAndConfiguration e
        // We don't support non-UTF-8 encodings, so this requires a manual test
        public void z1(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-aaaaaaaaaa/000/z1.wgt";);
-               System.out.println("Manual test: charset for start file of 
"+widget.getAttributeValue("identifier")+" must be ISO-8859-1");
+               System.out.println("Manual test: charset for start file of 
"+widget.getAttributeValue("id")+" must be ISO-8859-1");
                
        }
        
@@ -935,7 +935,7 @@ public class PackagingAndConfiguration e
        // We don't support non-UTF-8 encodings, so this requires a manual test
        public void z2(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-aaaaaaaaaa/001/z2.wgt";);
-               System.out.println("Manual test: charset for start file of 
"+widget.getAttributeValue("identifier")+" must be Windows-1252");
+               System.out.println("Manual test: charset for start file of 
"+widget.getAttributeValue("id")+" must be Windows-1252");
                
        }
        
@@ -943,26 +943,26 @@ public class PackagingAndConfiguration e
        @Test
        public void e1(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-KNiLPOKdgQ/000/e1.wgt";);
-               System.out.println("Manual 
test:"+widget.getAttributeValue("identifier")+":the feature feature:a9bb79c1 
must not have any params associated with it.");
+               System.out.println("Manual 
test:"+widget.getAttributeValue("id")+":the feature feature:a9bb79c1 must not 
have any params associated with it.");
        }
        //37
        @Test
        public void df(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-rZdcMBExBX/000/df.wgt";);
-               System.out.println("Manual 
test:"+widget.getAttributeValue("identifier")+":To pass, the feature list must 
remain empty. ");
+               System.out.println("Manual 
test:"+widget.getAttributeValue("id")+":To pass, the feature list must remain 
empty. ");
 
        }
        @Test
        @Ignore
        public void dr(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-rZdcMBExBX/001/dr.wgt";);
-               System.out.println("Manual 
test:"+widget.getAttributeValue("identifier")+":the feature list must contain 
one feature named 'feature:a9bb79c1' whose required value is false.");
+               System.out.println("Manual 
test:"+widget.getAttributeValue("id")+":the feature list must contain one 
feature named 'feature:a9bb79c1' whose required value is false.");
        }
        
        @Test
        public void ha(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-rZdcMBExBX/002/ha.wgt";);
-               System.out.println("Manual 
test:"+widget.getAttributeValue("identifier")+":To pass, the feature list must 
contain two features. Both are named 'feature:a9bb79c1'. One feature must have 
a parameter named \"test\" whose value is \"pass1\" The other feature must have 
a parameter named \"test\" whose value is \"pass2\" (the order in which the 
features appear in the feature list in not relevant).");
+               System.out.println("Manual 
test:"+widget.getAttributeValue("id")+":To pass, the feature list must contain 
two features. Both are named 'feature:a9bb79c1'. One feature must have a 
parameter named \"test\" whose value is \"pass1\" The other feature must have a 
parameter named \"test\" whose value is \"pass2\" (the order in which the 
features appear in the feature list in not relevant).");
        }
 
        //38
@@ -976,7 +976,7 @@ public class PackagingAndConfiguration e
        @Test
        public void gg(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-ignore-unrequired-feature-with-invalid-name/000/gg.wgt";);
           
-               System.out.println("Manual 
test:"+widget.getAttributeValue("identifier")+":the user agent must not contain 
any values in the feature list (i.e., the unknown feature is skipped).");
+               System.out.println("Manual 
test:"+widget.getAttributeValue("id")+":the user agent must not contain any 
values in the feature list (i.e., the unknown feature is skipped).");
        }
        
        //39
@@ -989,41 +989,41 @@ public class PackagingAndConfiguration e
        @Test
        public void d5(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-luyKMFABLX/000/d5.wgt";);
-               System.out.println("Manual 
test:"+widget.getAttributeValue("identifier")+":the user agent must not contain 
any values in the feature list (i.e., the unknown feature is skipped).");
+               System.out.println("Manual 
test:"+widget.getAttributeValue("id")+":the user agent must not contain any 
values in the feature list (i.e., the unknown feature is skipped).");
        }
        //41
        @Test
        public void dt(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-EGkPfzCBOz/000/dt.wgt";);
-               System.out.println("Manual 
test:"+widget.getAttributeValue("identifier")+":the feature list must contain 
one feature named 'feature:a9bb79c1' with no associated parameters. ");
+               System.out.println("Manual 
test:"+widget.getAttributeValue("id")+":the feature list must contain one 
feature named 'feature:a9bb79c1' with no associated parameters. ");
        }
        @Test
        public void dg(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-EGkPfzCBOz/001/dg.wgt";);
-               System.out.println("Manual 
test:"+widget.getAttributeValue("identifier")+":the feature list must contain 
one feature named 'feature:a9bb79c1' with one associated parameter whose name 
is 'PASS' and whose value is 'PASS'. ");
+               System.out.println("Manual 
test:"+widget.getAttributeValue("id")+":the feature list must contain one 
feature named 'feature:a9bb79c1' with one associated parameter whose name is 
'PASS' and whose value is 'PASS'. ");
        }       
        @Test
        public void v9(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-EGkPfzCBOz/002/v9.wgt";);
-               System.out.println("Manual 
test:"+widget.getAttributeValue("identifier")+":the feature list must contain 
one feature named 'feature:a9bb79c1' with two associated parameters whose name 
is 'PASS' and whose value are 'value1' and 'value2'.");
+               System.out.println("Manual 
test:"+widget.getAttributeValue("id")+":the feature list must contain one 
feature named 'feature:a9bb79c1' with two associated parameters whose name is 
'PASS' and whose value are 'value1' and 'value2'.");
        }
        //42
        @Test
        public void d6(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-xlgUWUVzCY/000/d6.wgt";);
-               System.out.println("Manual 
test:"+widget.getAttributeValue("identifier")+":feature 'feature:a9bb79c1' must 
not have any associated parameters.");
+               System.out.println("Manual 
test:"+widget.getAttributeValue("id")+":feature 'feature:a9bb79c1' must not 
have any associated parameters.");
        }
 
        // 43 Feature
        @Test
        public void e2(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-CEGwkNQcWo/000/e2.wgt";);
-               System.out.println("Manual 
test:"+widget.getAttributeValue("identifier")+":the feature feature:a9bb79c1 
must not have any associated params. ");
+               System.out.println("Manual 
test:"+widget.getAttributeValue("id")+":the feature feature:a9bb79c1 must not 
have any associated params. ");
        }
        @Test
        public void e3(){
                Element widget = 
processWidgetNoErrors("http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-CEGwkNQcWo/001/e3.wgt";);
-               System.out.println("Manual 
test:"+widget.getAttributeValue("identifier")+":the feature feature:a9bb79c1 
must not have any associated params. ");
+               System.out.println("Manual 
test:"+widget.getAttributeValue("id")+":the feature feature:a9bb79c1 must not 
have any associated params. ");
        }
        
        //44
@@ -1303,21 +1303,21 @@ public class PackagingAndConfiguration e
        }
        
        private String getLocalIconPath(Element widget, Element iconElem){
-               String id = widget.getAttributeValue("identifier");
+               String id = widget.getAttributeValue("id");
                id = WidgetPackageUtils.convertIdToFolderName(id);
                String baseUrl = 
"http://localhost:8080/wookie/wservices/"+id+"/";;      
                if(iconElem == null) return null;
-               String iconUrl = iconElem.getText();
+               String iconUrl = iconElem.getAttributeValue("src");
                String icon = StringUtils.difference(baseUrl,iconUrl);
                return icon;
        }
 
        private String getWidgetShortName(Element widget){
-               return widget.getChild("title").getAttributeValue("short");
+               return widget.getChild("name").getAttributeValue("short");
        }
 
-       private String getWidgetTitle(Element widget){
-               return widget.getChild("title").getText();
+       private String getWidgetname(Element widget){
+               return widget.getChild("name").getText();
        }
 
        private String getWidgetWidth(Element widget){

Modified: 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetsControllerTest.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetsControllerTest.java?rev=1298179&r1=1298178&r2=1298179&view=diff
==============================================================================
--- 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetsControllerTest.java
 (original)
+++ 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetsControllerTest.java
 Wed Mar  7 22:38:51 2012
@@ -29,6 +29,11 @@ import org.apache.commons.httpclient.met
 import org.apache.commons.httpclient.methods.multipart.FilePart;
 import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
 import org.apache.commons.httpclient.methods.multipart.Part;
+import org.apache.commons.io.FileUtils;
+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.jdom.JDOMException;
 import org.junit.AfterClass;
 import org.junit.Test;
@@ -63,7 +68,7 @@ public class WidgetsControllerTest exten
                int code = get.getStatusCode();
                assertEquals(200,code);
                String response = get.getResponseBodyAsString();
-               assertTrue(response.contains("<widget id=\"1\" 
identifier=\"http://notsupported\"";));
+               assertTrue(response.contains("<widget 
id=\"http://notsupported\"";));
                get.releaseConnection();
        }
        
@@ -80,7 +85,7 @@ public class WidgetsControllerTest exten
                int code = get.getStatusCode();
                assertEquals(200,code);
                String response = get.getResponseBodyAsString();
-               assertTrue(response.contains("<widget id=\"1\" 
identifier=\"http://notsupported\"";));
+               assertTrue(response.contains("<widget 
id=\"http://notsupported\"";));
                get.releaseConnection();
        }
        
@@ -97,7 +102,7 @@ public class WidgetsControllerTest exten
           int code = get.getStatusCode();
           assertEquals(200,code);
           String response = get.getResponseBodyAsString();
-          assertTrue(response.contains("<widget id=\"1\" 
identifier=\"http://notsupported\"";));
+          assertTrue(response.contains("<widget id=\"http://notsupported\"";));
           get.releaseConnection();
   }
   /**
@@ -113,7 +118,7 @@ public class WidgetsControllerTest exten
           int code = get.getStatusCode();
           assertEquals(200,code);
           String response = get.getResponseBodyAsString();
-          assertTrue(response.contains("<widget id=\"1\" 
identifier=\"http://notsupported\"";));
+          assertTrue(response.contains("<widget id=\"http://notsupported\"";));
           get.releaseConnection();
   }
        
@@ -175,6 +180,34 @@ public class WidgetsControllerTest exten
        }
        
        @Test
+       public void downloadWidgetPackage() throws BadWidgetZipFileException, 
BadManifestException, Exception{
+    HttpClient client = new HttpClient();      
+    GetMethod get = new 
GetMethod(TEST_WIDGETS_SERVICE_URL_VALID+"/http://notsupported";);
+    get.setRequestHeader("accept", "application/widget");
+    get.setFollowRedirects(true);
+    client.executeMethod(get);
+    
+    assertEquals(200, get.getStatusCode());
+    
+    File file = File.createTempFile("wookie", ".wgt");
+    FileUtils.writeByteArrayToFile(file, get.getResponseBody());
+    
+    System.out.println(get.getStatusCode());
+    
+    
+    File outputFolder = File.createTempFile("temp", 
Long.toString(System.nanoTime()));
+    outputFolder.delete();
+    outputFolder.mkdir();
+    
+    System.out.println(outputFolder.getPath());
+    
+    W3CWidgetFactory fac = new W3CWidgetFactory();
+    fac.setOutputDirectory(outputFolder.getPath());
+    W3CWidget widget = fac.parse(file);
+    assertEquals("Unsupported widget widget", widget.getLocalName("en"));
+       }
+       
+       @Test
        public void importWrongFileType() throws HttpException, IOException{
          HttpClient client = new HttpClient();
          //

Modified: incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetHelper.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetHelper.java?rev=1298179&r1=1298178&r2=1298179&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetHelper.java 
(original)
+++ incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetHelper.java Wed 
Mar  7 22:38:51 2012
@@ -95,8 +95,7 @@ public class WidgetHelper {
                String out = "";
 
                out += "\t<widget " +
-               "id=\""+widget.getId()
-               +"\" identifier=\"" + widget.getGuid() 
+               "id=\"" + widget.getGuid() 
                +"\" width=\"" + width
                +"\" height=\"" + height
                + "\" version=\"" + 
StringEscapeUtils.escapeXml(widget.getVersion())
@@ -150,12 +149,12 @@ public class WidgetHelper {
                        shortName = name.getShortName();
                        longName = name.getName();
                }
-               String out = "\t\t<title "; 
+               String out = "\t\t<name "; 
                if (name != null && name.getDir()!=null) out+=" 
dir=\""+name.getDir()+"\"";
                if (shortName != null) out +=" 
short=\""+StringEscapeUtils.escapeXml(shortName) + "\"";
                out +=">";
                if(longName != null) out += 
StringEscapeUtils.escapeXml(longName); 
-               out += "</title>\n";
+               out += "</name>\n";
                return out;
        }
 
@@ -192,7 +191,7 @@ public class WidgetHelper {
                                        if (icon.getHeight()!=null) out += " 
height=\""+icon.getHeight()+"\"";
                                        if (icon.getWidth()!=null) out += " 
width=\""+icon.getWidth()+"\"";
                                        if (icon.getLang()!=null) out += " 
xml:lang=\""+icon.getLang()+"\"";
-                                       out += ">"+urlWidgetIcon.toString() + 
"</icon>\n";
+                                       out += " 
src=\""+urlWidgetIcon.toString() + "\"/>\n";
                                } catch (MalformedURLException e) {
                                        // don't export icon field if its not a 
valid URL
                                }


Reply via email to