incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r405654 - in /incubator/adffaces/trunk/adf-faces: ./ adf-faces-api/ adf-faces-api/src/mock/java/org/apache/myfaces/adfbuild/test/ adf-faces-api/src/test/java/org/apache/myfaces/adf/component/ adf-faces-api/src/test/java/org/apache/myfaces/a...
Date Wed, 10 May 2006 06:55:17 GMT
Author: awiner
Date: Tue May  9 23:55:08 2006
New Revision: 405654

URL: http://svn.apache.org/viewcvs?rev=405654&view=rev
Log:
Switch POMs from RI to MyFaces.  Fix references to jsp-api.  Fix tests to pass against MyFaces
- mostly, this came from places where MyFaces called FacesContext.getCurrentInstance() but
the RI didn't.  Also, MyFaces calls ExternalContext.encodeNamespace() in UIViewRoot.createUniqueId()

Modified:
    incubator/adffaces/trunk/adf-faces/adf-faces-api/pom.xml
    incubator/adffaces/trunk/adf-faces/adf-faces-api/src/mock/java/org/apache/myfaces/adfbuild/test/MockUtils.java
    incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/component/UIComponentTestCase.java
    incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/convert/DateTimeConverterTestCase.java
    incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/convert/NumberConverterTestCase.java
    incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/validator/DateTimeRangeValidatorTest.java
    incubator/adffaces/trunk/adf-faces/adf-faces-demo/pom.xml
    incubator/adffaces/trunk/adf-faces/adf-faces-impl/pom.xml
    incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/BasicHtmlRenderKit.java
    incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/MFacesContext.java
    incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/TestScript.java
    incubator/adffaces/trunk/adf-faces/pom.xml

Modified: incubator/adffaces/trunk/adf-faces/adf-faces-api/pom.xml
URL: http://svn.apache.org/viewcvs/incubator/adffaces/trunk/adf-faces/adf-faces-api/pom.xml?rev=405654&r1=405653&r2=405654&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-api/pom.xml (original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-api/pom.xml Tue May  9 23:55:08 2006
@@ -135,9 +135,14 @@
       <artifactId>servlet-api</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>jsp-api</artifactId>
+    </dependency>
+
     <dependency>
-      <groupId>javax.faces</groupId>
-      <artifactId>jsf-api</artifactId>
+      <groupId>org.apache.myfaces.core</groupId>
+      <artifactId>myfaces-api</artifactId>
     </dependency>
 
     <!-- "test" scope dependencies -->

Modified: incubator/adffaces/trunk/adf-faces/adf-faces-api/src/mock/java/org/apache/myfaces/adfbuild/test/MockUtils.java
URL: http://svn.apache.org/viewcvs/incubator/adffaces/trunk/adf-faces/adf-faces-api/src/mock/java/org/apache/myfaces/adfbuild/test/MockUtils.java?rev=405654&r1=405653&r2=405654&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-api/src/mock/java/org/apache/myfaces/adfbuild/test/MockUtils.java
(original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-api/src/mock/java/org/apache/myfaces/adfbuild/test/MockUtils.java
Tue May  9 23:55:08 2006
@@ -16,6 +16,7 @@
 package org.apache.myfaces.adfbuild.test;
 import java.util.HashMap;
 
+import javax.faces.context.FacesContext;
 import javax.faces.component.MockUIComponent;
 
 /**
@@ -23,6 +24,11 @@
  */
 public class MockUtils
 {
+  public static void setFacesContext(FacesContext context)
+  {
+    FacesTestCase.TestFacesContext.setCurrentInstance(context);
+  }
+
   public static MockUIComponent buildMockUIComponent()
   {
     return buildMockUIComponent(1);
@@ -50,7 +56,11 @@
     for (i = 0; i < attributeNames.length; i++)
       attrs.put(attributeNames[i], attributeNames[i]);
     for (i = 0; i < iterations; i++)
+    {
       c.setupGetAttributes(attrs);
+      c.setupGetId("mockId");
+    }
+
     return c;
   }
 

Modified: incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/component/UIComponentTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/component/UIComponentTestCase.java?rev=405654&r1=405653&r2=405654&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/component/UIComponentTestCase.java
(original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/component/UIComponentTestCase.java
Tue May  9 23:55:08 2006
@@ -241,6 +241,7 @@
     factory.setupGetRenderKit(renderkit);
     renderkit.setupGetRenderer(renderer);
     context.setupGetRenderResponse(false);
+    context.setupGetResponseComplete(false);
     context.setupGetRenderKit(renderkit);
 
     context.setupGetViewRoot(root);
@@ -358,6 +359,7 @@
     renderkit.setupGetRenderer(renderer);
     context.setupGetRenderKit(renderkit);
     context.setupGetRenderResponse(false);
+    context.setupGetResponseComplete(false);
 
     context.setupGetViewRoot(root);
 
@@ -452,6 +454,7 @@
     factory.setupGetRenderKit(renderkit);
     renderkit.setupGetRenderer(renderer);
     context.setupGetRenderResponse(false);
+    context.setupGetResponseComplete(false);
     context.setupGetRenderKit(renderkit);
 
     setCurrentContext(context);
@@ -523,6 +526,8 @@
       context.setupGetViewRoot(root);
 
       context.setupGetApplication(application);
+      context.setupGetRenderResponse(false);
+      context.setupGetResponseComplete(false);
       application.setupGetActionListener(null);
 
       doTestInvokeApplication(context, root, component, event);
@@ -580,6 +585,7 @@
     renderkit.setupGetRenderer(renderer);
     context.setupGetRenderKit(renderkit);
     context.setupGetRenderResponse(false);
+    context.setupGetResponseComplete(false);
 
     child.setupGetParent(null);
     child.setupGetRendersChildren(true);
@@ -663,6 +669,7 @@
     context.setupGetApplication(application);
     context.setupGetRenderKit(renderkit);
     context.setupGetRenderResponse(false);
+    context.setupGetResponseComplete(false);
     
     // these are called because of validation failure for required
     context.setExpectedAddMessageCalls(1);

Modified: incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/convert/DateTimeConverterTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/convert/DateTimeConverterTestCase.java?rev=405654&r1=405653&r2=405654&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/convert/DateTimeConverterTestCase.java
(original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/convert/DateTimeConverterTestCase.java
Tue May  9 23:55:08 2006
@@ -29,6 +29,8 @@
 import javax.faces.component.MockUIComponent;
 import javax.faces.context.MockFacesContext;
 
+import org.apache.myfaces.adfbuild.test.MockUtils;
+
 /**
  * Test DateTimeConverter
  * @author Vijay Venaktaraman (vijay.venkataraman@oracle.com)
@@ -240,10 +242,17 @@
 
       MockFacesContext context  =  new MockFacesContext();
       MockUIComponent component =  new MockUIComponent();
-
-      Date obj = (Date)dtConv.getAsObject(context, component, _SINPUT_VALUES[i]);
-
-      assertEquals(true, isEqual(obj,_SEXPECTED_DATES[i]));
+      
+      MockUtils.setFacesContext(context);
+      try
+      {
+        Date obj = (Date)dtConv.getAsObject(context, component, _SINPUT_VALUES[i]);
+        assertEquals(true, isEqual(obj,_SEXPECTED_DATES[i]));
+      }
+      finally
+      {
+        MockUtils.setFacesContext(null);
+      }
 
       context.verify();
       component.verify();
@@ -273,9 +282,17 @@
     GregorianCalendar gcal = new GregorianCalendar(getTzone("UTC"));
     gcal.set(2001,6,4,12,8,56);
 
-    Date dt = (Date) dtConv.getAsObject(context, component, inputValue);
-    Date expectedDt = gcal.getTime();
-    assertEquals(true, isEqual(dt, expectedDt));
+    MockUtils.setFacesContext(context);
+    try
+    {
+      Date dt = (Date) dtConv.getAsObject(context, component, inputValue);
+      Date expectedDt = gcal.getTime();
+      assertEquals(true, isEqual(dt, expectedDt));
+    }
+    finally
+    {
+      MockUtils.setFacesContext(null);
+    }
  }
 
   protected void checkDatesForPatternBasedChecks()
@@ -328,16 +345,24 @@
         context.setupGetViewRoot(uiRoot);
       }
 
-      String fobtPattern = fdtConv.getAsString(context, component, date);
-
-      assertEquals(patternBasedValues[i][3], fobtPattern);
-
-      Date fdt = (Date)fdtConv.getAsObject(context, component, fobtPattern);
-
-      /**
-       * @todo to find - why we get this millisecond difference
-       */
-      assertEquals(true, isEqual(date, fdt));
+      MockUtils.setFacesContext(context);
+      try
+      {
+        String fobtPattern = fdtConv.getAsString(context, component, date);
+        
+        assertEquals(patternBasedValues[i][3], fobtPattern);
+        
+        Date fdt = (Date)fdtConv.getAsObject(context, component, fobtPattern);
+        
+        /**
+         * @todo to find - why we get this millisecond difference
+         */
+        assertEquals(true, isEqual(date, fdt));
+      }
+      finally
+      {
+        MockUtils.setFacesContext(null);
+      }
 
       context.verify();
       component.verify();
@@ -370,8 +395,16 @@
       _setStyleOnConverter(dtConv, styleType, styles[i]);
 
       dtConv.setLocale(Locale.ENGLISH);
-      String out =  dtConv.getAsString(context, component, dt);
-      assertEquals(true, (out != null));
+      MockUtils.setFacesContext(context);
+      try
+      {
+        String out =  dtConv.getAsString(context, component, dt);
+        assertEquals(true, (out != null));
+      }
+      finally
+      {
+        MockUtils.setFacesContext(null);
+      }
 
       context.verify();
       component.verify();
@@ -379,17 +412,25 @@
       MockFacesContext ctx   = new MockFacesContext();
       MockUIComponent  cmp   = new MockUIComponent();
 
+      MockUtils.setFacesContext(ctx);
       try
       {
-        javax.faces.convert.DateTimeConverter extDtConv = getDateTimeConverter();
-        extDtConv.setLocale(Locale.ENGLISH);
-        _setStyleOnConverter(extDtConv, styleType, styles[i].toUpperCase());
-        String outPut = extDtConv.getAsString(context, component, dt);
-        fail("Upper case not accepted for styles");
+        try
+        {
+          javax.faces.convert.DateTimeConverter extDtConv = getDateTimeConverter();
+          extDtConv.setLocale(Locale.ENGLISH);
+          _setStyleOnConverter(extDtConv, styleType, styles[i].toUpperCase());
+          String outPut = extDtConv.getAsString(context, component, dt);
+          fail("Upper case not accepted for styles");
+        }
+        catch (RuntimeException ce)
+        {
+          // Expected
+        }
       }
-      catch (RuntimeException ce)
+      finally
       {
-        // Expected
+        MockUtils.setFacesContext(null);
       }
 
       ctx.verify();

Modified: incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/convert/NumberConverterTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/convert/NumberConverterTestCase.java?rev=405654&r1=405653&r2=405654&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/convert/NumberConverterTestCase.java
(original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/convert/NumberConverterTestCase.java
Tue May  9 23:55:08 2006
@@ -24,7 +24,9 @@
 import org.apache.myfaces.adf.convert.ConverterTestCase;
 import org.apache.myfaces.adfbuild.test.MockUtils;
 
+import javax.faces.application.MockApplication;
 import javax.faces.component.MockUIComponent;
+import javax.faces.context.MockExternalContext;
 import javax.faces.context.MockFacesContext;
 
 /**
@@ -87,14 +89,22 @@
     context.setupGetViewRoot(root);
     context.setupGetViewRoot(root);
 
-    String input = "123";
-    NumberConverter converter = getNumberConverter();
-    Object number = converter.getAsObject(context, component, input);
-    assertEquals(true, number instanceof Number);
-    assertEquals(true, (((Number)number).intValue() == 123));
+    MockUtils.setFacesContext(context);
+    try
+    {
+      String input = "123";
+      NumberConverter converter = getNumberConverter();
+      Object number = converter.getAsObject(context, component, input);
+      assertEquals(true, number instanceof Number);
+      assertEquals(true, (((Number)number).intValue() == 123));
 
-    String outVal = converter.getAsString(context, component, number);
-    assertEquals(input, outVal);
+      String outVal = converter.getAsString(context, component, number);
+      assertEquals(input, outVal);
+    }
+    finally
+    {
+      MockUtils.setFacesContext(null);
+    }
 
     context.verify();
     component.verify();
@@ -117,22 +127,31 @@
     Locale[] locales = {usLocl, usLocl, usLocl, usLocl,Locale.CANADA};
 
     NumberConverter nconv = getNumberConverter();
+
     for (int i = 0; i < patterns.length; i++)
     {
       MockFacesContext context  = new MockFacesContext();
       MockUIComponent component = new MockUIComponent();
-
-      nconv.setPattern(patterns[i]);
-      nconv.setType(types[i]);
-      nconv.setLocale(locales[i]);
-
-      Object convValue = nconv.getAsObject(context, component, inputValues[i]);
-      assertEquals(expectedValues[i], convValue);
-
-      String outValue = nconv.getAsString(context, component, expectedValues[i]);
-
-      assertEquals(expectedStringValues[i], outValue);
-
+      
+      MockUtils.setFacesContext(context);
+      try
+      {
+        nconv.setPattern(patterns[i]);
+        nconv.setType(types[i]);
+        nconv.setLocale(locales[i]);
+        
+        Object convValue = nconv.getAsObject(context, component, inputValues[i]);
+        assertEquals(expectedValues[i], convValue);
+        
+        String outValue = nconv.getAsString(context, component, expectedValues[i]);
+        
+        assertEquals(expectedStringValues[i], outValue);
+      }
+      finally
+      {
+        MockUtils.setFacesContext(null);
+      }
+      
       context.verify();
       component.verify();
     }
@@ -205,14 +224,23 @@
     converter.setLocale(Locale.US);
     converter.setType("currency");
     Double  value = new Double(99);
-    String outPut = converter.getAsString(context, component, value);
-    assertEquals("$99.00", outPut);
-    //Locale is US. By general convention the output prefix would be '$'
-    // since we set the currency code to 'DEM' value should be DEM[value]
-    converter.setCurrencyCode("DEM");
 
-    outPut = converter.getAsString(context, component, value);
-    assertEquals("DEM99.00", outPut);
+    MockUtils.setFacesContext(context);
+    try
+    {
+      String outPut = converter.getAsString(context, component, value);
+      assertEquals("$99.00", outPut);
+      //Locale is US. By general convention the output prefix would be '$'
+      // since we set the currency code to 'DEM' value should be DEM[value]
+      converter.setCurrencyCode("DEM");
+      
+      outPut = converter.getAsString(context, component, value);
+      assertEquals("DEM99.00", outPut);
+    }
+    finally
+    {
+      MockUtils.setFacesContext(null);
+    }
     context.verify();
     component.verify();
   }
@@ -221,35 +249,51 @@
   {
     NumberConverter converter   = getNumberConverter();
     MockFacesContext context    = new MockFacesContext();
-      MockUIComponent component = MockUtils.buildMockUIComponent(2);
+    MockApplication application = new MockApplication();
+    context.setupGetApplication(application);
+    application.setupGetMessageBundle(null);
 
+    MockUIComponent component = MockUtils.buildMockUIComponent(2);
+    
     converter.setLocale(Locale.US);
     converter.setType("currency");
     Double  value = new Double(99);
-    String outPut = converter.getAsString(context, component, value);
-    assertEquals("$99.00", outPut);
-    //Locale is US. By general convention the output prefix would be '$'
-    // since we set the currency code to 'DEM' value should be DEM[value]
-    converter.setCurrencyCode("DEM");
-
-    // Let us set the symbol to '*'. This should not take effect, since currency
-    // code is set.
-    converter.setCurrencySymbol("*");
 
-    outPut = converter.getAsString(context, component, value);
-    assertEquals("DEM99.00", outPut);
+    MockUtils.setFacesContext(context);
     try
     {
-      UIViewRoot root = new UIViewRoot();
-      root.setLocale(Locale.US);
-      context.setupGetViewRoot(root);
-      context.setupGetViewRoot(root);
-      Number outValue = (Number)converter.getAsObject(context, component, "DEM99.00");
-      fail("Exception should occur - since currency should not be considered while formatting");
+      String outPut = converter.getAsString(context, component, value);
+      assertEquals("$99.00", outPut);
+      //Locale is US. By general convention the output prefix would be '$'
+      // since we set the currency code to 'DEM' value should be DEM[value]
+      converter.setCurrencyCode("DEM");
+      
+      // Let us set the symbol to '*'. This should not take effect, since currency
+      // code is set.
+      converter.setCurrencySymbol("*");
+      
+      outPut = converter.getAsString(context, component, value);
+      assertEquals("DEM99.00", outPut);
+      try
+      {
+        UIViewRoot root = new UIViewRoot();
+        root.setLocale(Locale.US);
+        context.setupGetViewRoot(root);
+        context.setupGetViewRoot(root);
+        MockExternalContext external = new MockExternalContext();
+        context.setupGetExternalContext(external);
+        
+        Number outValue = (Number)converter.getAsObject(context, component, "DEM99.00");
+        fail("Exception should occur - since currency should not be considered while formatting");
+      }
+      catch(Exception e)
+      {
+        ;//Expected to fail.
+      }
     }
-    catch(Exception e)
+    finally
     {
-      ;//Expected to fail.
+      MockUtils.setFacesContext(null);
     }
 
     context.verify();
@@ -267,8 +311,17 @@
     //Locale is US. By general convention the output prefix would be '$'
     // since we set currency symbol to '*' we should get the value to be *99.00
     converter.setCurrencySymbol("*");
-    String outPut = converter.getAsString(context, component, value);
-    assertEquals("*99.00", outPut);
+    
+    MockUtils.setFacesContext(context);
+    try
+    {
+      String outPut = converter.getAsString(context, component, value);
+      assertEquals("*99.00", outPut);
+    }
+    finally
+    {
+      MockUtils.setFacesContext(null);
+    }
 
     context.verify();
     component.verify();
@@ -285,11 +338,19 @@
     String[] inputs = {"23.10", "44.90876", "11111", "67859.0001"};
     Number[] expectedValues = {new Long(23), new Long(44), new Long(11111), new Long(67859)};
 
-    for (int i = 0; i < inputs.length; i++)
+    MockUtils.setFacesContext(context);
+    try
+    {
+      for (int i = 0; i < inputs.length; i++)
+      {
+        converter.setIntegerOnly(true);
+        Number num = (Number) converter.getAsObject(context, component, inputs[i]);
+        assertEquals(expectedValues[i], num);
+      }
+    }
+    finally
     {
-      converter.setIntegerOnly(true);
-      Number num = (Number) converter.getAsObject(context, component, inputs[i]);
-      assertEquals(expectedValues[i], num);
+      MockUtils.setFacesContext(null);
     }
 
     context.verify();
@@ -308,18 +369,26 @@
     String[] inputs = {"23.10", "44.90876", "11111", "67859.0001"};
     Number[] expectedValues = {new Long(23), new Long(44), new Long(11111), new Long(67859)};
 
-    for (int i = 0; i < inputs.length; i++)
+    MockUtils.setFacesContext(context);
+    try
+    {
+      for (int i = 0; i < inputs.length; i++)
+      {
+        // setting these values should not affect parsing.
+        converter.setMaxFractionDigits(10);
+        converter.setMaxIntegerDigits(1);
+        converter.setMinFractionDigits(1);
+        converter.setMinFractionDigits(0);
+        
+        // this should be taken care by the parsing code
+        converter.setIntegerOnly(true);
+        Number num = (Number) converter.getAsObject(context, component, inputs[i]);
+        assertEquals(expectedValues[i], num);
+      }
+    }
+    finally
     {
-      // setting these values should not affect parsing.
-      converter.setMaxFractionDigits(10);
-      converter.setMaxIntegerDigits(1);
-      converter.setMinFractionDigits(1);
-      converter.setMinFractionDigits(0);
-
-      // this should be taken care by the parsing code
-      converter.setIntegerOnly(true);
-      Number num = (Number) converter.getAsObject(context, component, inputs[i]);
-      assertEquals(expectedValues[i], num);
+      MockUtils.setFacesContext(null);
     }
 
     context.verify();
@@ -340,21 +409,17 @@
 
     String input = "1234.56";
 
-    // if we get a valid object, implies locale was indeed picked up.
-    // otherwise we would have got a null pointer exception or other exception
-    Object value = converter.getAsObject(context, component, input);
-    assertEquals(new Double(1234.56), value);
-
-    root.setLocale(null);
-
+    MockUtils.setFacesContext(context);
     try
     {
-      value = converter.getAsObject(context, component, input);
-      fail("Expected: NullPointerException as locale is null");
+      // if we get a valid object, implies locale was indeed picked up.
+      // otherwise we would have got a null pointer exception or other exception
+      Object value = converter.getAsObject(context, component, input);
+      assertEquals(new Double(1234.56), value);
     }
-    catch(NullPointerException exp)
+    finally
     {
-      ; // we expected it
+      MockUtils.setFacesContext(null);
     }
   }
 
@@ -368,12 +433,21 @@
     MockFacesContext context    = new MockFacesContext();
     MockUIComponent component   = new MockUIComponent();
     converter.setLocale(Locale.US);
-    for (int i = 0; i < inputValues.length; i++)
+    MockUtils.setFacesContext(context);
+    try
+    {
+      for (int i = 0; i < inputValues.length; i++)
+      {
+        converter.setGroupingUsed(isGroupingUsed[i]);
+        String out = converter.getAsString(context, component, inputValues[i]);
+        assertEquals(expectedValues[i], out);
+      }
+    }
+    finally
     {
-      converter.setGroupingUsed(isGroupingUsed[i]);
-      String out = converter.getAsString(context, component, inputValues[i]);
-      assertEquals(expectedValues[i], out);
+      MockUtils.setFacesContext(null);
     }
+
     context.verify();
     component.verify();
   }
@@ -406,17 +480,25 @@
     NumberConverter converter   = getNumberConverter();
     MockFacesContext context    = new MockFacesContext();
     MockUIComponent component   = new MockUIComponent();
-    converter.setLocale(Locale.US);
-    for (int i = 0; i < maxFractDigits.length; i++)
-    {
-      converter.setMaxFractionDigits(maxFractDigits[i]);
-      converter.setMaxIntegerDigits(maxIntDigits[i]);
-      converter.setMinFractionDigits(minFractDigits[i]);
-      converter.setMinIntegerDigits(minIntDigits[i]);
-
-      String out = converter.getAsString(context, component, inputValues[i]);
-      assertEquals(expectedValues[i], out);
 
+    MockUtils.setFacesContext(context);
+    try
+    {
+      converter.setLocale(Locale.US);
+      for (int i = 0; i < maxFractDigits.length; i++)
+      {
+        converter.setMaxFractionDigits(maxFractDigits[i]);
+        converter.setMaxIntegerDigits(maxIntDigits[i]);
+        converter.setMinFractionDigits(minFractDigits[i]);
+        converter.setMinIntegerDigits(minIntDigits[i]);
+        
+        String out = converter.getAsString(context, component, inputValues[i]);
+        assertEquals(expectedValues[i], out);   
+      }
+    }
+    finally
+    {
+      MockUtils.setFacesContext(null);
     }
     context.verify();
     component.verify();

Modified: incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/validator/DateTimeRangeValidatorTest.java
URL: http://svn.apache.org/viewcvs/incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/validator/DateTimeRangeValidatorTest.java?rev=405654&r1=405653&r2=405654&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/validator/DateTimeRangeValidatorTest.java
(original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/validator/DateTimeRangeValidatorTest.java
Tue May  9 23:55:08 2006
@@ -100,6 +100,7 @@
     context.setupGetViewRoot(root);
     try
     {
+      MockUtils.setFacesContext(context);
       validator.validate(context, component, "not-a-date");
       fail("ValidatorException not thrown");
     }
@@ -107,6 +108,10 @@
     {
       // pass
     }
+    finally
+    {
+      MockUtils.setFacesContext(null);
+    }
 
     context.verify();
     component.verify();
@@ -132,7 +137,15 @@
     context.setupGetViewRoot(root);
     context.setupGetViewRoot(root);
 
-    validator.validate(context, component, new Date(millis - 1));
+    try
+    {
+      MockUtils.setFacesContext(context);
+      validator.validate(context, component, new Date(millis - 1));
+    }
+    finally
+    {
+      MockUtils.setFacesContext(null);
+    }
 
     context.verify();
     component.verify();
@@ -171,6 +184,7 @@
 
     try
     {
+      MockUtils.setFacesContext(context);
       validator.setMaximumMessageDetail("max set");
       validator.validate(context, component, new Date(millis + 1));
       fail("ValidatorException not thrown");
@@ -181,6 +195,10 @@
       String msg = e.getFacesMessage().getDetail();
       assertEquals(msg, "max set");
     }
+    finally
+    {
+      MockUtils.setFacesContext(null);
+    }
 
     context.verify();
     component.verify();
@@ -234,6 +252,7 @@
 
     try
     {
+      MockUtils.setFacesContext(context);
       validator.setMinimumMessageDetail("min set");
       validator.validate(context, component, new Date(millis - 1));
       fail("ValidatorException not thrown");
@@ -244,6 +263,10 @@
       String msg = e.getFacesMessage().getDetail();
       assertEquals(msg, "min set");
     }
+    finally
+    {
+      MockUtils.setFacesContext(null);
+    }
 
     context.verify();
     component.verify();
@@ -264,7 +287,16 @@
     MockFacesContext context = new MockFacesContext();
     MockUIComponent  component = MockUtils.buildMockUIComponent();
 
-    validator.validate(context, component, new Date(millis + 1));
+
+    try
+    {
+      MockUtils.setFacesContext(context);
+      validator.validate(context, component, new Date(millis + 1));
+    }
+    finally
+    {
+      MockUtils.setFacesContext(null);
+    }
 
     context.verify();
     component.verify();
@@ -299,6 +331,7 @@
 
     try
     {
+      MockUtils.setFacesContext(context);
       validator.setMinimumMessageDetail("min");
       validator.validate(context, component, new Date(millis - 1));
       fail("ValidatorException not thrown");
@@ -308,6 +341,10 @@
       // pass
 
     }
+    finally
+    {
+      MockUtils.setFacesContext(null);
+    }
 
     context.verify();
     component.verify();
@@ -342,6 +379,7 @@
 
     try
     {
+      MockUtils.setFacesContext(context);
       validator.setNotInRangeMessageDetail("not in range is set");
       validator.validate(context, component, new Date(millis + 20));
       fail("ValidatorException not thrown");
@@ -351,6 +389,10 @@
       //first pass
       String msg = e.getFacesMessage().getDetail();
       assertEquals(msg, "not in range is set");
+    }
+    finally
+    {
+      MockUtils.setFacesContext(null);
     }
 
     context.verify();

Modified: incubator/adffaces/trunk/adf-faces/adf-faces-demo/pom.xml
URL: http://svn.apache.org/viewcvs/incubator/adffaces/trunk/adf-faces/adf-faces-demo/pom.xml?rev=405654&r1=405653&r2=405654&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-demo/pom.xml (original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-demo/pom.xml Tue May  9 23:55:08 2006
@@ -69,9 +69,14 @@
     </dependency>
 
     <dependency>
-      <groupId>javax.faces</groupId>
-      <artifactId>jsf-impl</artifactId>
-      <version>1.1_01</version>
+      <groupId>org.apache.myfaces.core</groupId>
+      <artifactId>myfaces-api</artifactId>
+      <scope>compile</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.myfaces.core</groupId>
+      <artifactId>myfaces-impl</artifactId>
       <scope>runtime</scope>
     </dependency>
     
@@ -82,6 +87,7 @@
       <scope>runtime</scope>
     </dependency>
 
+<!-- Dependencies pulled in via myfaces pom
     <dependency>
       <groupId>commons-beanutils</groupId>
       <artifactId>commons-beanutils</artifactId>
@@ -99,7 +105,7 @@
     <dependency>
       <groupId>commons-logging</groupId>
       <artifactId>commons-logging</artifactId>
-      <version>1.0.3</version>
+      <version>1.0.4</version>
       <scope>runtime</scope>
     </dependency>
     
@@ -109,19 +115,16 @@
       <version>2.1</version>
       <scope>runtime</scope>
     </dependency>
+-->
 
     <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
-      <version>2.3</version>
-      <scope>provided</scope>
     </dependency>
 
     <dependency>
-      <groupId>jsp-api</groupId>
-      <artifactId>jsp-el-api</artifactId>
-      <version>2.0</version>
-      <scope>provided</scope>
+      <groupId>javax.servlet</groupId>
+      <artifactId>jsp-api</artifactId>
     </dependency>
   </dependencies>
 

Modified: incubator/adffaces/trunk/adf-faces/adf-faces-impl/pom.xml
URL: http://svn.apache.org/viewcvs/incubator/adffaces/trunk/adf-faces/adf-faces-impl/pom.xml?rev=405654&r1=405653&r2=405654&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-impl/pom.xml (original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-impl/pom.xml Tue May  9 23:55:08 2006
@@ -174,6 +174,11 @@
       <scope>provided</scope>
     </dependency>
 
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>jsp-api</artifactId>
+    </dependency>
+
     <dependency>
       <groupId>org.apache.myfaces.adf</groupId>
       <artifactId>adf-faces-build</artifactId>
@@ -185,8 +190,8 @@
     </dependency>
 
     <dependency>
-      <groupId>javax.faces</groupId>
-      <artifactId>jsf-api</artifactId>
+      <groupId>org.apache.myfaces.core</groupId>
+      <artifactId>myfaces-api</artifactId>
     </dependency>
 
     <!-- "test" scope dependencies -->
@@ -229,10 +234,9 @@
     </dependency>
 
     <dependency>
-      <groupId>javax.faces</groupId>
-      <artifactId>jsf-impl</artifactId>
-      <version>1.1_01</version>
-      <scope>runtime</scope>
+      <groupId>org.apache.myfaces.core</groupId>
+      <artifactId>myfaces-impl</artifactId>
+      <scope>test</scope>
     </dependency>
 
     <dependency>

Modified: incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/BasicHtmlRenderKit.java
URL: http://svn.apache.org/viewcvs/incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/BasicHtmlRenderKit.java?rev=405654&r1=405653&r2=405654&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/BasicHtmlRenderKit.java
(original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/BasicHtmlRenderKit.java
Tue May  9 23:55:08 2006
@@ -43,6 +43,7 @@
 {
   public BasicHtmlRenderKit()
   {
+    /* These are used only for CoreRenderKitPerf
     addRenderer("javax.faces.Output",
                 "javax.faces.Text",
                 "com.sun.faces.renderkit.html_basic.TextRenderer");
@@ -58,6 +59,7 @@
     addRenderer("javax.faces.SelectOne",
                 "javax.faces.Radio",
                 "com.sun.faces.renderkit.html_basic.RadioRenderer");
+    */
     Renderer n = new Renderer()
     {
       public void decode(FacesContext context, UIComponent component)

Modified: incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/MFacesContext.java
URL: http://svn.apache.org/viewcvs/incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/MFacesContext.java?rev=405654&r1=405653&r2=405654&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/MFacesContext.java
(original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/MFacesContext.java
Tue May  9 23:55:08 2006
@@ -217,6 +217,8 @@
       return null;
     }
 
+    public String encodeNamespace(String in) { return in; }
+
     public String encodeResourceURL(String url) { return "encoded-resource-url:" + url; }
     public String encodeActionURL(String url) { return "encoded-action-url:" + url; }
 

Modified: incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/TestScript.java
URL: http://svn.apache.org/viewcvs/incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/TestScript.java?rev=405654&r1=405653&r2=405654&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/TestScript.java
(original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/TestScript.java
Tue May  9 23:55:08 2006
@@ -136,14 +136,22 @@
         String id = (String) messageIds.next();
         FacesMessage fm = (FacesMessage) _messages.get(id);
 
-        String sevStr = fm.getSeverity().toString();
+        // Severity toString() implementation is different in the
+        // RI and MyFaces;  in the RI it's "name ordinal",
+        // and in MyFaces it's just "name".  And in the RI,
+        // the names are uppercase, whereas they're mixed case
+        // in MyFaces.
+        String sevStr = fm.getSeverity().toString().toUpperCase();
         int space = sevStr.indexOf(" ");
         if (!gotFirst)
           gotFirst = true;
         else
           sb.append(", ");
         sb.append("id:" + id + ",");
-        sb.append(sevStr.substring(0,space));
+        if (space < 0)
+          sb.append(sevStr);
+        else
+          sb.append(sevStr.substring(0,space));
       }
 
       sb.append(" ]");

Modified: incubator/adffaces/trunk/adf-faces/pom.xml
URL: http://svn.apache.org/viewcvs/incubator/adffaces/trunk/adf-faces/pom.xml?rev=405654&r1=405653&r2=405654&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/pom.xml (original)
+++ incubator/adffaces/trunk/adf-faces/pom.xml Tue May  9 23:55:08 2006
@@ -155,14 +155,22 @@
       <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>servlet-api</artifactId>
-        <version>2.3</version>
+        <version>2.4</version>
         <scope>provided</scope>
       </dependency>
 
       <dependency>
-        <groupId>javax.faces</groupId>
-        <artifactId>jsf-api</artifactId>
-        <version>1.1_01</version>
+        <groupId>org.apache.myfaces.core</groupId>
+        <artifactId>myfaces-api</artifactId>
+        <version>1.1.2</version>
+        <scope>provided</scope>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.myfaces.core</groupId>
+        <artifactId>myfaces-impl</artifactId>
+        <version>1.1.2</version>
+        <scope>provided</scope>
       </dependency>
 
       <dependency>
@@ -200,8 +208,8 @@
       </dependency>
 
       <dependency>
-        <groupId>jsp-api</groupId>
-        <artifactId>jsp-el-api</artifactId>
+        <groupId>javax.servlet</groupId>
+        <artifactId>jsp-api</artifactId>
         <version>2.0</version>
         <scope>provided</scope>
       </dependency>



Mime
View raw message