incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r413942 - in /incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit: CoreRenderKitTest.java RenderKitTestCase.java
Date Tue, 13 Jun 2006 18:11:50 GMT
Author: awiner
Date: Tue Jun 13 11:11:50 2006
New Revision: 413942

URL: http://svn.apache.org/viewvc?rev=413942&view=rev
Log:
Remove all Trinidad-specific code from the base RenderKitTestCase class, so it can be used
for other renderkits and component sets

Modified:
    incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/CoreRenderKitTest.java
    incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/RenderKitTestCase.java

Modified: incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/CoreRenderKitTest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/CoreRenderKitTest.java?rev=413942&r1=413941&r2=413942&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/CoreRenderKitTest.java
(original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/CoreRenderKitTest.java
Tue Jun 13 11:11:50 2006
@@ -18,10 +18,24 @@
 import java.io.IOException;
 
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
 
 import junit.framework.Test;
 
+import org.apache.myfaces.adf.component.core.CoreDocument;
+import org.apache.myfaces.adf.component.core.CoreForm;
+import org.apache.myfaces.adf.component.html.HtmlHtml;
+
+import org.apache.myfaces.adfinternal.renderkit.core.CoreRenderKit;
+
 import org.xml.sax.SAXException;
 
 
@@ -50,11 +64,51 @@
     return "org.apache.myfaces.adf.core";
   }
 
+  protected UIComponent populateDefaultComponentTree(
+    UIViewRoot  root,
+    TestScript  script)
+  {
+    String componentType = 
+           script.getDefinition().getComponentInfo().componentType;
+
+    if ("org.apache.myfaces.adf.HtmlHtml".equals(componentType))
+    {
+      return root;
+    }
+    
+    if (_sHtmlComponents.contains(componentType))
+    {
+      HtmlHtml html = new HtmlHtml();
+      html.setId("htmlId");
+      root.getChildren().add(html);
+      return html;
+    }
+    else
+    {
+      CoreDocument doc = new CoreDocument();
+      doc.setId("docId");
+      root.getChildren().add(doc);
+      CoreForm form = new CoreForm();
+      form.setId("formId");
+      if (script.getDefinition().isUsesUpload())
+        form.setUsesUpload(true);
+      doc.getChildren().add(form);
+      return form;
+    }
+  }
+
   static private List<SuiteDefinition> _definitions =
     new ArrayList<SuiteDefinition>();
+  private static HashSet _sHtmlComponents;
 
   static
   {
+    // Force the CoreRenderKit logger level to SEVERE, to bypass the
+    // warnings about not finding the Basic HTML RenderKit.
+    Logger logger = Logger.getLogger(CoreRenderKit.class.getName());
+    logger.setLevel(Level.SEVERE);
+    logger.setUseParentHandlers(false);
+
     _definitions.add(new SuiteDefinition("minimal",
                                          "minimal",
                                          null,
@@ -90,5 +144,12 @@
                                          "inaccessible",
                                          RenderKitBootstrap.getGeckoAgent(),
                                          false));
+
+    _sHtmlComponents = new HashSet(5);
+    _sHtmlComponents.add("org.apache.myfaces.adf.HtmlBody");
+    _sHtmlComponents.add("org.apache.myfaces.adf.HtmlFrame");
+    _sHtmlComponents.add("org.apache.myfaces.adf.HtmlFrameBorderLayout");
+    _sHtmlComponents.add("org.apache.myfaces.adf.HtmlHead");
+    _sHtmlComponents.add("org.apache.myfaces.adf.CoreStyleSheet");
   }
 }

Modified: incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/RenderKitTestCase.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/RenderKitTestCase.java?rev=413942&r1=413941&r2=413942&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/RenderKitTestCase.java
(original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/RenderKitTestCase.java
Tue Jun 13 11:11:50 2006
@@ -39,14 +39,10 @@
 import javax.faces.render.RenderKit;
 
 import org.apache.myfaces.adf.context.Agent;
-import org.apache.myfaces.adf.component.core.CoreDocument;
-import org.apache.myfaces.adf.component.core.CoreForm;
-import org.apache.myfaces.adf.component.html.HtmlHtml;
 import org.apache.myfaces.adf.render.ExtendedRenderKitService;
 import org.apache.myfaces.adf.util.Service;
 
 import org.apache.myfaces.adfinternal.io.XhtmlResponseWriter;
-import org.apache.myfaces.adfinternal.renderkit.core.CoreRenderKit;
 
 import junit.framework.AssertionFailedError;
 import junit.framework.Test;
@@ -122,11 +118,6 @@
     {
       if (!_script.isSupportedAgentType(_agent.getType()))
       {
-        /*
-        System.out.println("SKIPPING UNSUPPORTED SCRIPT: " + _scriptName);
-        System.out.println("AGENT IS " + _agent);
-        System.out.println("AGENT TYPE IS " + _agent.getType());
-        */
         return;
       }
 
@@ -134,8 +125,8 @@
       // aborting the run
       _result = result;
       CatchSevere catchSevere = new CatchSevere();
-      Logger oracleLogger = Logger.getLogger("oracle");
-      oracleLogger.addHandler(catchSevere);
+      Logger apacheLogger = Logger.getLogger("org.apache");
+      apacheLogger.addHandler(catchSevere);
 
       try
       {
@@ -144,7 +135,7 @@
       }
       finally
       {
-        oracleLogger.removeHandler(catchSevere);
+        apacheLogger.removeHandler(catchSevere);
         RenderKitBootstrap.clearFactories();
       }
     }
@@ -196,7 +187,8 @@
 
       _initializeContext(new NullWriter());
 
-      UIComponent docRoot = _createDocumentRoot(root);
+      UIComponent docRoot = populateDefaultComponentTree(root,
+                                                         _script);
 
       StringWriter first = new StringWriter();
       docRoot.getChildren().add(new GatherContent(first,
@@ -334,38 +326,6 @@
     {
       RenderUtils.encodeRecursive(_facesContext, root);
     }
-
-
-    private UIComponent _createDocumentRoot(UIViewRoot root)
-    {
-      String componentType = 
-             _script.getDefinition().getComponentInfo().componentType;
-      
-      if ("org.apache.myfaces.adf.HtmlHtml".equals(componentType))
-      {
-        return root;
-      }
-      
-      if (_sHtmlComponents.contains(componentType))
-      {
-        HtmlHtml html = new HtmlHtml();
-        html.setId("htmlId");
-        root.getChildren().add(html);
-        return html;
-      }
-      else
-      {
-        CoreDocument doc = new CoreDocument();
-        doc.setId("docId");
-        root.getChildren().add(doc);
-        CoreForm form = new CoreForm();
-        form.setId("formId");
-        if (_script.getDefinition().isUsesUpload())
-          form.setUsesUpload(true);
-        doc.getChildren().add(form);
-        return form;
-      }
-    }
     
     private void _initializeContext(Writer out) throws IOException
     {
@@ -428,19 +388,6 @@
     _scriptDir = new File(scripts);
     _goldenDir = new File(golden);
     _failureDir = new File(failures);
-    
-    _sHtmlComponents = new HashSet(5);
-    _sHtmlComponents.add("org.apache.myfaces.adf.HtmlBody");
-    _sHtmlComponents.add("org.apache.myfaces.adf.HtmlFrame");
-    _sHtmlComponents.add("org.apache.myfaces.adf.HtmlFrameBorderLayout");
-    _sHtmlComponents.add("org.apache.myfaces.adf.HtmlHead");
-    _sHtmlComponents.add("org.apache.myfaces.adf.CoreStyleSheet");
-
-    // Force the CoreRenderKit logger level to SEVERE, to bypass the
-    // warnings about not finding the Basic HTML RenderKit.
-    Logger logger = Logger.getLogger(CoreRenderKit.class.getName());
-    logger.setLevel(Level.SEVERE);
-    logger.setUseParentHandlers(false);
   }
 
   private void _initTests() throws IOException, SAXException
@@ -496,6 +443,10 @@
     }
   }
 
+  protected abstract UIComponent populateDefaultComponentTree(
+    UIViewRoot root,
+    TestScript script);
+
   protected abstract Iterable<SuiteDefinition> getSuiteDefinitions();
   protected abstract String getRenderKitId();
 
@@ -573,5 +524,4 @@
   static private File _scriptDir;
   static private File _goldenDir;
   static private File _failureDir;
-  private static HashSet _sHtmlComponents;
 }



Mime
View raw message