You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2008/08/01 01:51:47 UTC

svn commit: r681557 - in /portals/jetspeed-2/portal/branches/JS2-869: components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/ components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/ components/jetspeed-serializer/...

Author: taylor
Date: Thu Jul 31 16:51:46 2008
New Revision: 681557

URL: http://svn.apache.org/viewvc?rev=681557&view=rev
Log:
Im working on http://issues.apache.org/jira/browse/JS2-869
but I've found that the new build is really quite a learning curve, so I tried to write some unit tests to put the build through its paces, and make use of the filtering aspects of th spring assembly.
Thus we have a new abstract test for using filters with the goal of just pointing your test cases at the assembly dirs and letting the filters sort out what actually gets loaded. 
see AbstractFilteredSpringTestCase.java for more details. Also see the TestSerializer.java, which is disabled because of cyclical dependencies, but if you enable this test you can see the filtering in action.
Also wrote a TestSnapshot to test loading seed data, which can be useful. For now I am turning off the "null value" support as its broken. I will make a second pass on the preferences serialization to handle read only and multivalues
The seed data now appears to be loading correctly, with exception of user info and prefs. I am now writing the new service (not yet checked in) to implement principal preferences, which will be stored in a separate table from portlet preferences.
Will then hook in seed data's <user-info> into the new principal preferences 
Im also seeing some failures in retrieving portlet preferences in the actual portal. I need to get some better test cases in place to test both portal and principal preferences and wrap this up with a commit of both

Added:
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractFilteredSpringTestCase.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/java/
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/java/org/
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/java/org/apache/
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/java/org/apache/jetspeed/
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/java/org/apache/jetspeed/serializer/
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/java/org/apache/jetspeed/serializer/TestSerializer.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/java/org/apache/jetspeed/serializer/TestSnapshot.java
Modified:
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceEnabledSpringTestCase.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/pom.xml
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElement.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-portal-resources/src/main/resources/assembly/serializer.xml

Added: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractFilteredSpringTestCase.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractFilteredSpringTestCase.java?rev=681557&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractFilteredSpringTestCase.java (added)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractFilteredSpringTestCase.java Thu Jul 31 16:51:46 2008
@@ -0,0 +1,174 @@
+package org.apache.jetspeed.components.test;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.jetspeed.components.JetspeedBeanDefinitionFilter;
+
+/**
+ * Base class for tests that want to use spring with the Jetspeed filtering feature enabled. The added value here is that you can simply point your
+ * tests at a assembly directory, and have the filters decide which spring beans to load based on filtering categories.
+ * 
+ * @author taylor
+ */
+public abstract class AbstractFilteredSpringTestCase extends AbstractSpringTestCase
+{
+    /**
+     * Override the location of the test properties by using the jetspeed properties found in the default package.
+     * Make sure to have your unit test copy in jetspeed properties into the class path root like:
+     <blockquote><pre>
+        &lt;resource&gt;
+            &lt;path&gt;conf/jetspeed&lt;/path&gt;
+            &lt;include&gt;*.properties&lt;/include&gt;                                        
+        &lt;/resource&gt;                                         
+     </pre></blockquote>
+     */
+    @Override    
+    protected Properties getInitProperties()
+    {
+        Properties props = new Properties();
+        try 
+        {
+            InputStream is = this.getClass().getClassLoader().getResourceAsStream("jetspeed.properties");
+            if (is != null)
+                props.load(is);
+        } catch (FileNotFoundException e) 
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } 
+        catch (IOException e) 
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        return props;
+    }
+           
+    /**
+     * Override the location of the Jetspeed Spring assemblies files by pulling in all xml files found in the assembly package.
+     * Make sure to have your unit test copy assemblies into the class path assembly directory like:
+     <blockquote><pre>
+        &lt;resource&gt;
+            &lt;path&gt;assembly&lt;/path&gt;
+            &lt;include&gt;*.xml,boot/*.xml&lt;/include&gt;
+            &lt;destination&gt;assembly&lt;/destination&gt;
+         &lt;/resource&gt;
+     </pre></blockquote>
+     */
+    @Override
+    protected String[] getConfigurations() 
+    {
+        return getResourcesFromClasspath("assembly");
+    }   
+    
+    /**
+     * Override the location of the Jetspeed Boot Spring assemblies files by pulling in all xml files found in the assembly package.
+     * Make sure to have your unit test copy assemblies into the class path assembly directory like:
+     <blockquote><pre>
+        &lt;resource&gt;
+            &lt;path&gt;assembly&lt;/path&gt;
+            &lt;include&gt;*.xml,boot/*.xml&lt;/include&gt;
+            &lt;destination&gt;assembly&lt;/destination&gt;
+         &lt;/resource&gt;
+     </pre></blockquote>
+     */
+    protected String[] getBootConfigurations()
+    {
+        return new String[]
+        { "assembly/boot/datasource.xml"};
+    }
+    
+    /**
+     * Support for loading all Spring assembly resources from the class path and then letting the bean filtering mechanism sort out what beans to load.
+     * You can call it like above: 
+     * <blockquote><pre>
+     *   protected String[] getConfigurations() 
+     *   {
+     *       return getResourcesFromClasspath("assembly");
+     *   }
+     * </pre></blockquote>
+     * @param classPathDirectory
+     * @return an array of all possible assembly files on the classpath (non-filtered). 
+     */
+    protected String[] getResourcesFromClasspath(String classPathDirectory)
+    {
+        List<String> result = new ArrayList<String>();
+        FilenameFilter filter = new AssemblyFilter();
+        try 
+        {
+            Enumeration<URL> locations = this.getClass().getClassLoader().getResources(classPathDirectory);
+            while (locations.hasMoreElements())
+            {
+                URL url = locations.nextElement();
+                File dir = new File(url.getFile());
+                String assemblies[] = dir.list(filter);
+                if (assemblies != null)
+                {
+                    for (int ix=0; ix < assemblies.length; ix++)
+                    {
+                        assemblies[ix] = classPathDirectory + "/" + assemblies[ix];
+                    }
+                    result.addAll(Arrays.asList(assemblies));
+                }
+            }           
+        } 
+        catch (IOException e) 
+        {
+            e.printStackTrace();
+        }
+        return (String[])result.toArray(new String[0]);
+    }
+    
+    protected class AssemblyFilter implements FilenameFilter
+    {
+        public boolean accept(File dir, String name)
+        {
+            if (name.equals("jetspeed-properties.xml"))
+                return false;
+            return name.toLowerCase().endsWith(".xml");             
+        }
+    }
+
+    @Override
+    protected String getBeanDefinitionFilterCategories()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
+    @Override
+    protected String getBeanDefinitionFilterCategoryKey()
+    {
+        return "default";
+    }
+
+    protected String getFilterFile()
+    {
+        return "spring-filter.properties";        
+    }
+    
+    /**
+     * Helper to either use a list of categories, comma separated, with <code>getBeanDefinitionFilterCategories</code> or
+     * use a single category key with <code>getBeanDefinitionFilterCategoryKey</code> combined with <code>getFilterFile</code> 
+     */
+    @Override
+    protected JetspeedBeanDefinitionFilter getBeanDefinitionFilter() throws IOException
+    {
+        String categories = getBeanDefinitionFilterCategories();
+        if (categories == null)
+            return new JetspeedBeanDefinitionFilter(getFilterFile(), getBeanDefinitionFilterCategoryKey());
+        else
+            return new JetspeedBeanDefinitionFilter(categories);
+    }
+
+}

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java?rev=681557&r1=681556&r2=681557&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java Thu Jul 31 16:51:46 2008
@@ -81,5 +81,21 @@
         return new JetspeedBeanDefinitionFilter(getBeanDefinitionFilterCategories());
     }
     
+    /**
+     * Have your test provide its spring-filter categories with a comma separated list of categories
+     * @return a list of one or more filter categories
+     */
     protected abstract String getBeanDefinitionFilterCategories();
+
+    /**
+     * Have your test provide its spring-filter categories with a single category key. Keys are usually configured 
+     * in the spring-filter.properties file as a list of one or more categories.
+     * 
+     * @return a single category key string
+     */    
+    protected String getBeanDefinitionFilterCategoryKey()
+    {
+        return null;
+    }
+    
 }

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceEnabledSpringTestCase.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceEnabledSpringTestCase.java?rev=681557&r1=681556&r2=681557&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceEnabledSpringTestCase.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceEnabledSpringTestCase.java Thu Jul 31 16:51:46 2008
@@ -59,6 +59,11 @@
         { "boot/datasource.xml"};
     }
 
+    protected String getBeanDefinitionFilterCategoryKey()
+    {
+        return null; // not implemented
+    }
+    
     protected String getBeanDefinitionFilterCategories()
     {
         return "default,jdbcDS";

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/pom.xml?rev=681557&r1=681556&r2=681557&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/pom.xml Thu Jul 31 16:51:46 2008
@@ -118,7 +118,100 @@
             <artifactId>xercesImpl</artifactId>
             <scope>runtime</scope>
         </dependency>
+        <!-- 
+        The following commented out dependencies are necessary to run the TestSerializer unit test. However,
+         since this brings in circular dependency references to the build (breaking the build),
+        I have commented out the TestSerializer as well as disabling the test
+       
+        <dependency>
+            <groupId>${pom.groupId}</groupId>
+            <artifactId>jetspeed-registry</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>${pom.groupId}</groupId>
+            <artifactId>jetspeed-capability</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>${pom.groupId}</groupId>
+            <artifactId>jetspeed-profiler</artifactId>
+            <scope>test</scope>
+        </dependency>
+         -->
+        <dependency>
+            <groupId>tyrex</groupId>
+            <artifactId>tyrex</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>${org.apache.jetspeed.test.jdbc.driver.groupId}</groupId>
+            <artifactId>${org.apache.jetspeed.test.jdbc.driver.artifactId}</artifactId>
+            <version>${org.apache.jetspeed.test.jdbc.driver.version}</version>
+            <scope>test</scope>
+        </dependency>      
         
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>**/TestSerializer.java</exclude>                    
+					</excludes>
+				</configuration>                
+            </plugin>
+            <plugin>
+                <groupId>${pom.groupId}</groupId>
+                <artifactId>jetspeed-unpack-maven-plugin</artifactId>
+                <version>${pom.version}</version>
+                <executions>
+                    <execution>
+                        <id>unpack-test-resources</id>
+                        <goals>
+                            <goal>unpack</goal>
+                        </goals>
+                        <phase>process-test-resources</phase>
+                        <configuration>
+                            <skip>${maven.test.skip}</skip>
+                            <unpack>
+                                <targetDirectory>${project.build.testOutputDirectory}</targetDirectory>
+                                <resources>
+                                    <resource>
+                                        <path>assembly</path>
+                                        <include>*.xml,boot/*.xml</include>
+                                        <destination>assembly</destination>
+                                    </resource>
+                                    <resource>
+                                        <path>db-ojb</path>
+                                    </resource>
+                                    <resource>
+                                        <path>conf/jetspeed</path>
+                                        <include>*.properties</include>                                        
+                                    </resource>                                    
+                                    <resource>
+                                        <path>seed</path>
+                                        <include>*.xml</include>                                        
+                                    </resource>                                    
+                                </resources>
+                            </unpack>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>            
+		</plugins>
+        <testResources>
+            <testResource>
+                <directory>src/test/resources</directory>
+                <filtering>true</filtering>
+            </testResource>
+        </testResources>
+	</build>
+	
 </project>

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java?rev=681557&r1=681556&r2=681557&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java Thu Jul 31 16:51:46 2008
@@ -110,7 +110,7 @@
     public void importData(String filename, Map settings) throws SerializerException
     {
         Map processSettings = getProcessSettings(settings);
-        JSSnapshot snapshot = readSnapshot(filename, binding);
+        JSSnapshot snapshot = readSnapshot(filename);
 
         if (snapshot == null)
             throw new SerializerException(SerializerException.FILE_PROCESSING_ERROR.create(new String[] { filename,
@@ -216,7 +216,6 @@
         binding.setAlias(JSEntities.class, "Entities");
         binding.setAlias(JSEntityPreference.class, "Principal");
         binding.setAlias(JSEntityPreferences.class, "Settings");
-        binding.setAlias(JSNVPElements.class, "preferences");
 
         binding.setAlias(String.class, "String");
         binding.setAlias(Integer.class, "int");
@@ -224,13 +223,17 @@
         binding.setClassAttribute(null);
     }
 
-    protected JSSnapshot readSnapshot(String importFileName, XMLBinding binding) throws SerializerException
+    protected JSSnapshot readSnapshot(String importFileName) throws SerializerException
     {
         XMLObjectReader reader = null;
         JSSnapshot snap = null;
         try
         {
-            reader = XMLObjectReader.newInstance(new FileInputStream(importFileName));
+        	File exists = new File(importFileName);
+        	if (exists.exists())
+        		reader = XMLObjectReader.newInstance(new FileInputStream(importFileName));
+        	else
+        		reader = XMLObjectReader.newInstance(this.getClass().getClassLoader().getResourceAsStream(importFileName));
         }
         catch (Exception e)
         {
@@ -239,8 +242,8 @@
         }
         try
         {
-            if (binding != null)
-                reader.setBinding(binding);
+            if (this.binding != null)
+                reader.setBinding(this.binding);
             snap = (JSSnapshot) reader.read(TAG_SNAPSHOT, JSSnapshot.class);
         }
         catch (Exception e)

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElement.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElement.java?rev=681557&r1=681556&r2=681557&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElement.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElement.java Thu Jul 31 16:51:46 2008
@@ -24,71 +24,91 @@
 
 public class JSNVPElement
 {
+
     private String key;
+
     private String value;
+
     private boolean nullValue;
-    public JSNVPElement() {};
+
+    public JSNVPElement()
+    {
+    };
+
     public JSNVPElement(String key, String value)
     {
-    	this.key = key;
-    	this.value = value;
+        this.key = key;
+        this.value = value;
     }
 
-         private static final XMLFormat XML = new XMLFormat(JSNVPElement.class)
+    private static final XMLFormat XML = new XMLFormat(JSNVPElement.class)
+    {
+
+        @SuppressWarnings("unused")
+        public boolean isReferencable()
         {
-            public boolean isReferencable() {
-                return false; // Always manipulates by value.
-            }
-            public void write(Object o, OutputElement xml)
-            throws XMLStreamException
+            return false; // Always manipulates by value.
+        }
+
+        public void write(Object o, OutputElement xml)
+                throws XMLStreamException
+        {
+            JSNVPElement e = (JSNVPElement) o;
+            // xml.add((String) g.get(_key), _key, String.class);
+
+            xml.add(e.key, "name", String.class);
+            if (e.nullValue)
+            {
+                xml.setAttribute("nullValue", true);
+            } else
             {
-                JSNVPElement e = (JSNVPElement)o;
-                // xml.add((String) g.get(_key), _key, String.class);
-                
-            	xml.add(e.key,"name",String.class);
-            	if (e.nullValue)
-            	{
-            	    xml.setAttribute("nullValue", true);
-            	}
-            	else
-            	{
-                    xml.add(e.value,"value",String.class);
-            	}
+                xml.add(e.value, "value", String.class);
             }
-            public void read(InputElement xml, Object o)
+        }
+
+        public void read(InputElement xml, Object o)
+        {
+            try
+            {
+                JSNVPElement g = (JSNVPElement) o;
+                g.key = StringEscapeUtils.unescapeHtml((String) xml.get("name",
+                        String.class));
+                g.value = StringEscapeUtils.unescapeHtml((String) xml.get(
+                        "value", String.class));
+                // DST: not sure what Ate was doing here, but it breaks things
+                // we also need to add upport for multiple values and 'readonly', but its not clear what this null value does for us
+                //                g.nullValue = xml.getAttribute("nullValue", false);                
+                //if (!g.nullValue)
+                //{
+                // g.value =
+                // StringEscapeUtils.unescapeHtml((String)xml.get("value",
+                // String.class));
+                // }
+            } catch (Exception e)
             {
-                try
-                {
-                    JSNVPElement g = (JSNVPElement) o;
-                    g.key = StringEscapeUtils.unescapeHtml((String)xml.get("name", String.class));
-                    g.nullValue = xml.getAttribute("nullValue", false);
-                    if (!g.nullValue)
-                    {
-                        g.value = StringEscapeUtils.unescapeHtml((String)xml.get("value", String.class));
-                    }
-                } catch (Exception e)
-                {
-                    e.printStackTrace();
-                }
+                e.printStackTrace();
             }
-        };
-		public String getKey()
-		{
-			return key;
-		}
-		public void setKey(String key)
-		{
-			this.key = key;
-		}
-		public String getValue()
-		{
-			return value;
-		}
-		public void setValue(String value)
-		{
-			this.value = value;
-			nullValue = value == null;
-		}
+        }
+    };
+
+    public String getKey()
+    {
+        return key;
+    }
+
+    public void setKey(String key)
+    {
+        this.key = key;
+    }
+
+    public String getValue()
+    {
+        return value;
+    }
+
+    public void setValue(String value)
+    {
+        this.value = value;
+        nullValue = value == null;
     }
-    
-    
+}

Added: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/java/org/apache/jetspeed/serializer/TestSerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/java/org/apache/jetspeed/serializer/TestSerializer.java?rev=681557&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/java/org/apache/jetspeed/serializer/TestSerializer.java (added)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/java/org/apache/jetspeed/serializer/TestSerializer.java Thu Jul 31 16:51:46 2008
@@ -0,0 +1,20 @@
+package org.apache.jetspeed.serializer;
+
+import org.apache.jetspeed.components.test.AbstractFilteredSpringTestCase;
+
+public class TestSerializer extends AbstractFilteredSpringTestCase 
+{        
+    public void testImport() throws Exception
+    {
+    	JetspeedSerializer serializer = (JetspeedSerializer)scm.getComponent("org.apache.jetspeed.serializer.JetspeedSerializer");
+    	assertNotNull(serializer);
+    	//serializer.importData("j2-seed.xml");
+    }
+    
+    @Override
+    protected String getBeanDefinitionFilterCategoryKey()
+    {
+        return "serializer";
+    }
+   	
+}

Added: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/java/org/apache/jetspeed/serializer/TestSnapshot.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/java/org/apache/jetspeed/serializer/TestSnapshot.java?rev=681557&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/java/org/apache/jetspeed/serializer/TestSnapshot.java (added)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/test/java/org/apache/jetspeed/serializer/TestSnapshot.java Thu Jul 31 16:51:46 2008
@@ -0,0 +1,31 @@
+package org.apache.jetspeed.serializer;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.jetspeed.serializer.objects.JSSnapshot;
+import org.apache.jetspeed.test.JetspeedTestCase;
+
+public class TestSnapshot extends JetspeedTestCase
+{
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+    }
+    
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+    }
+    
+    public void testSnapshot() throws Exception
+    {
+    	List<JetspeedComponentSerializer> serializers = new LinkedList<JetspeedComponentSerializer>();
+    	Map<String,String> settings = new HashMap<String,String>();
+    	JetspeedSerializerImpl serializer = new JetspeedSerializerImpl(serializers, settings);    
+    	JSSnapshot snapshot = serializer.readSnapshot("j2-seed.xml");
+    	assertNotNull(snapshot);
+    }
+}

Modified: portals/jetspeed-2/portal/branches/JS2-869/jetspeed-portal-resources/src/main/resources/assembly/serializer.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/jetspeed-portal-resources/src/main/resources/assembly/serializer.xml?rev=681557&r1=681556&r2=681557&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/jetspeed-portal-resources/src/main/resources/assembly/serializer.xml (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/jetspeed-portal-resources/src/main/resources/assembly/serializer.xml Thu Jul 31 16:51:46 2008
@@ -24,7 +24,8 @@
         <bean class="org.apache.jetspeed.serializer.JetspeedRegistrySerializer">
           <constructor-arg index="0" ref="org.apache.jetspeed.components.portletregistry.PortletRegistry" />
           <constructor-arg index="1" ref="org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent" />
-          <constructor-arg index="2" ref="org.apache.jetspeed.search.SearchEngine" />
+          <constructor-arg index="2" ref="org.apache.jetspeed.components.portletpreferences.PortletPreferencesProvider"/>
+          <constructor-arg index="3" ref="org.apache.jetspeed.search.SearchEngine" />
         </bean>
 <!-- 
         <bean class="org.apache.jetspeed.serializer.JetspeedUserTemplateSerializer">



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org