incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r425268 [7/7] - in /incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src: main/java-templates/org/apache/myfaces/adf/component/ main/java/org/apache/myfaces/adf/change/ main/java/org/apache/myfaces/adf/component...
Date Tue, 25 Jul 2006 03:54:52 GMT
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/model/RowKeySetTreeImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/model/SortableModelTest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/model/SortableModelTest.java?rev=425268&r1=425267&r2=425268&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/model/SortableModelTest.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/model/SortableModelTest.java Mon Jul 24 20:54:50 2006
@@ -13,212 +13,212 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-package org.apache.myfaces.adf.model;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.faces.model.DataModel;
-import javax.faces.model.ListDataModel;
+package org.apache.myfaces.adf.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import javax.faces.model.DataModel;
+import javax.faces.model.ListDataModel;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
-import org.apache.myfaces.adf.model.SortCriterion;
+import org.apache.myfaces.adf.model.SortCriterion;
 import org.apache.shale.test.base.AbstractJsfTestCase;
-
-/**
- * @author Arjuna Wijeyekoon
- */
-public class SortableModelTest extends AbstractJsfTestCase
-{
-  public SortableModelTest(String name)
-  {
-    super(name);
-  }
-
-	public void setUp()
-  {
-    super.setUp();
-  }
-
-	public void tearDown()
-  {
-    super.tearDown();
+
+/**
+ * @author Arjuna Wijeyekoon
+ */
+public class SortableModelTest extends AbstractJsfTestCase
+{
+  public SortableModelTest(String name)
+  {
+    super(name);
+  }
+
+	public void setUp()
+  {
+    super.setUp();
+  }
+
+	public void tearDown()
+  {
+    super.tearDown();
   }
   
   public static Test suite()
   {
     return new TestSuite(SortableModelTest.class);
-  }
-  
-  public void testInitialSort()
-  {
-    DataModel dModel = _createTestDataModel();
-    SortableModel sModel = new SortableModel(dModel);
-    _testInitialSort(sModel);
-  }
-
-  private void _testInitialSort(SortableModel sModel)
-  {
-    sModel.setRowIndex(0);
-    assertTrue(sModel.getRowData() == _bean1);
-    sModel.setRowIndex(1);
-    assertTrue(sModel.getRowData() == _bean2);
-    sModel.setRowIndex(2);
-    assertTrue(sModel.getRowData() == _bean3);
-  }
-  
-  public void testRowCount()
-  {
-    DataModel dModel = _createTestDataModel();
-    SortableModel sModel = new SortableModel(dModel);
-    assertTrue(sModel.getRowCount() == dModel.getRowCount());    
-    _sort(sModel, "name", true);    
-    assertTrue(sModel.getRowCount() == dModel.getRowCount());    
-  }
-
-  public void testSortableProperties()
-  {
-    DataModel dModel = _createTestDataModel();
-    SortableModel sModel = new SortableModel(dModel);
-    assertTrue(sModel.isSortable("age"));
-    assertTrue(sModel.isSortable("name"));
-    assertFalse(sModel.isSortable("object"));
-  }
-
-  public void testSortAscending()
-  {
-    DataModel dModel = _createTestDataModel();
-    SortableModel sModel = new SortableModel(dModel);
-    _sort(sModel, "name", true);    
-
-
-//    for (int i=0; i<sModel.getRowCount(); i++)
-//    {
-//      sModel.setRowIndex(i);
-//      System.out.println("i:"+i+" data:"+sModel.getRowData());
-//    }
-
-    sModel.setRowIndex(0);
-    assertTrue(sModel.getRowData() == _bean2);
-    sModel.setRowIndex(1);
-    assertTrue(sModel.getRowData() == _bean1);
-    sModel.setRowIndex(2);
-    assertTrue(sModel.getRowData() == _bean3);
-  }
-  
-  public void testUnsort()
-  {
-    DataModel dModel = _createTestDataModel();
-    SortableModel sModel = new SortableModel(dModel);
-    _sort(sModel, "name", true);    
-
-    sModel.setSortCriteria(null);
-    _testInitialSort(sModel);
-  }
-  
-  public void testSortDescending()
-  {
-    DataModel dModel = _createTestDataModel();
-    SortableModel sModel = new SortableModel(dModel);
-    _sort(sModel, "age", false);    
-    sModel.setRowIndex(0);
-    assertTrue(sModel.getRowData() == _bean2);
-    sModel.setRowIndex(1);
-    assertTrue(sModel.getRowData() == _bean3);
-    sModel.setRowIndex(2);
-    assertTrue(sModel.getRowData() == _bean1);
-  }
-  
-
-  // Test sorting an empty model - see bug 4258884
-  public void testEmptyTable()
-  {
-    DataModel emptyModel = new ListDataModel(new ArrayList());
-    SortableModel sModel = new SortableModel(emptyModel);
-    _sort(sModel, "age", false);    
-  }
-
-  public void testGetRowIndex()
-  {
-    DataModel dModel = _createTestDataModel();
-    SortableModel sModel = new SortableModel(dModel);
-    _sort(sModel, "age", true);    
-
-    dModel.setRowIndex(2); //Zach
-    assertTrue(sModel.getRowIndex() == 1);
-    dModel.setRowIndex(0); //Tracy
-    assertTrue(sModel.getRowIndex() == 0);
-    dModel.setRowIndex(1); //Anne
-    assertTrue(sModel.getRowIndex() == 2);
-  }
-
-  public void testSetRowIndex()
-  {
-    DataModel dModel = _createTestDataModel();
-    SortableModel sModel = new SortableModel(dModel);
-    _sort(sModel, "age", true);    
-
-    sModel.setRowIndex(1); //Zach
-    assertTrue(dModel.getRowIndex() == 2);
-    sModel.setRowIndex(0); //Tracy
-    assertTrue(dModel.getRowIndex() == 0);
-    sModel.setRowIndex(2); //Anne
-    assertTrue(dModel.getRowIndex() == 1);
-  }
-  
-  private DataModel _createTestDataModel()
-  {
-    List list = new ArrayList(3);
-    list.add(_bean1);
-    list.add(_bean2);
-    list.add(_bean3);
-    return new ListDataModel(Collections.unmodifiableList(list));
-  }
-
-  private void _sort(CollectionModel model, 
-                     String property, boolean isAscending)
-  {
-    SortCriterion criterion = new SortCriterion(property, isAscending);
-    model.setSortCriteria(Collections.singletonList(criterion));
-  }
-  
-  private final Bean _bean1 = new Bean(10, "Tracy");
-  private final Bean _bean2 = new Bean(15, "Anne");
-  private final Bean _bean3 = new Bean(12, "Zach");
-  
-  public static final class Bean
-  {
-    public Bean(int age, String name)
-    {
-      _age = age;
-      _name = name;
-      _obj = new Object();
-    }
-    
-    public int getAge()
-    {
-      return _age;
-    }
-    
-    public String getName()
-    {
-      return _name;
-    }
-    
-    // this is not sortable
-    public Object getObject()
-    {
-      return _obj;
-    }
-    
-    public String toString()
-    {
-      return "name:"+_name+" age:"+_age;
-    }
-    
-    private final int _age;
-    private final String _name;
-    private final Object _obj;
-  }
-}
+  }
+  
+  public void testInitialSort()
+  {
+    DataModel dModel = _createTestDataModel();
+    SortableModel sModel = new SortableModel(dModel);
+    _testInitialSort(sModel);
+  }
+
+  private void _testInitialSort(SortableModel sModel)
+  {
+    sModel.setRowIndex(0);
+    assertTrue(sModel.getRowData() == _bean1);
+    sModel.setRowIndex(1);
+    assertTrue(sModel.getRowData() == _bean2);
+    sModel.setRowIndex(2);
+    assertTrue(sModel.getRowData() == _bean3);
+  }
+  
+  public void testRowCount()
+  {
+    DataModel dModel = _createTestDataModel();
+    SortableModel sModel = new SortableModel(dModel);
+    assertTrue(sModel.getRowCount() == dModel.getRowCount());    
+    _sort(sModel, "name", true);    
+    assertTrue(sModel.getRowCount() == dModel.getRowCount());    
+  }
+
+  public void testSortableProperties()
+  {
+    DataModel dModel = _createTestDataModel();
+    SortableModel sModel = new SortableModel(dModel);
+    assertTrue(sModel.isSortable("age"));
+    assertTrue(sModel.isSortable("name"));
+    assertFalse(sModel.isSortable("object"));
+  }
+
+  public void testSortAscending()
+  {
+    DataModel dModel = _createTestDataModel();
+    SortableModel sModel = new SortableModel(dModel);
+    _sort(sModel, "name", true);    
+
+
+//    for (int i=0; i<sModel.getRowCount(); i++)
+//    {
+//      sModel.setRowIndex(i);
+//      System.out.println("i:"+i+" data:"+sModel.getRowData());
+//    }
+
+    sModel.setRowIndex(0);
+    assertTrue(sModel.getRowData() == _bean2);
+    sModel.setRowIndex(1);
+    assertTrue(sModel.getRowData() == _bean1);
+    sModel.setRowIndex(2);
+    assertTrue(sModel.getRowData() == _bean3);
+  }
+  
+  public void testUnsort()
+  {
+    DataModel dModel = _createTestDataModel();
+    SortableModel sModel = new SortableModel(dModel);
+    _sort(sModel, "name", true);    
+
+    sModel.setSortCriteria(null);
+    _testInitialSort(sModel);
+  }
+  
+  public void testSortDescending()
+  {
+    DataModel dModel = _createTestDataModel();
+    SortableModel sModel = new SortableModel(dModel);
+    _sort(sModel, "age", false);    
+    sModel.setRowIndex(0);
+    assertTrue(sModel.getRowData() == _bean2);
+    sModel.setRowIndex(1);
+    assertTrue(sModel.getRowData() == _bean3);
+    sModel.setRowIndex(2);
+    assertTrue(sModel.getRowData() == _bean1);
+  }
+  
+
+  // Test sorting an empty model - see bug 4258884
+  public void testEmptyTable()
+  {
+    DataModel emptyModel = new ListDataModel(new ArrayList());
+    SortableModel sModel = new SortableModel(emptyModel);
+    _sort(sModel, "age", false);    
+  }
+
+  public void testGetRowIndex()
+  {
+    DataModel dModel = _createTestDataModel();
+    SortableModel sModel = new SortableModel(dModel);
+    _sort(sModel, "age", true);    
+
+    dModel.setRowIndex(2); //Zach
+    assertTrue(sModel.getRowIndex() == 1);
+    dModel.setRowIndex(0); //Tracy
+    assertTrue(sModel.getRowIndex() == 0);
+    dModel.setRowIndex(1); //Anne
+    assertTrue(sModel.getRowIndex() == 2);
+  }
+
+  public void testSetRowIndex()
+  {
+    DataModel dModel = _createTestDataModel();
+    SortableModel sModel = new SortableModel(dModel);
+    _sort(sModel, "age", true);    
+
+    sModel.setRowIndex(1); //Zach
+    assertTrue(dModel.getRowIndex() == 2);
+    sModel.setRowIndex(0); //Tracy
+    assertTrue(dModel.getRowIndex() == 0);
+    sModel.setRowIndex(2); //Anne
+    assertTrue(dModel.getRowIndex() == 1);
+  }
+  
+  private DataModel _createTestDataModel()
+  {
+    List list = new ArrayList(3);
+    list.add(_bean1);
+    list.add(_bean2);
+    list.add(_bean3);
+    return new ListDataModel(Collections.unmodifiableList(list));
+  }
+
+  private void _sort(CollectionModel model, 
+                     String property, boolean isAscending)
+  {
+    SortCriterion criterion = new SortCriterion(property, isAscending);
+    model.setSortCriteria(Collections.singletonList(criterion));
+  }
+  
+  private final Bean _bean1 = new Bean(10, "Tracy");
+  private final Bean _bean2 = new Bean(15, "Anne");
+  private final Bean _bean3 = new Bean(12, "Zach");
+  
+  public static final class Bean
+  {
+    public Bean(int age, String name)
+    {
+      _age = age;
+      _name = name;
+      _obj = new Object();
+    }
+    
+    public int getAge()
+    {
+      return _age;
+    }
+    
+    public String getName()
+    {
+      return _name;
+    }
+    
+    // this is not sortable
+    public Object getObject()
+    {
+      return _obj;
+    }
+    
+    public String toString()
+    {
+      return "name:"+_name+" age:"+_age;
+    }
+    
+    private final int _age;
+    private final String _name;
+    private final Object _obj;
+  }
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/model/SortableModelTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/resource/AggregatingResourceLoaderTest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/resource/AggregatingResourceLoaderTest.java?rev=425268&r1=425267&r2=425268&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/resource/AggregatingResourceLoaderTest.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/resource/AggregatingResourceLoaderTest.java Mon Jul 24 20:54:50 2006
@@ -13,138 +13,138 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-package org.apache.myfaces.adf.resource;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-public class AggregatingResourceLoaderTest extends ResourceLoaderTestCase
-{
-  public AggregatingResourceLoaderTest(
-    String testName)
-  {
-    super(testName);
-  }
-
-  public void testContentLength() throws IOException
-  {
-    ResourceLoader loader = 
-      new AggregatingResourceLoader("test.xml", 
-                                    new String[]
-                                    {
-                                      "test-1.xml",
-                                      "test-2.xml"
-                                    },
-                                    new LocalResourceLoader());
-    doTestContentLength(loader.getResource("test.xml"));
-  }
-
-  public void testContentLengthWithException() throws IOException
-  {
-    try
-    {
-      AggregatingResourceLoader loader = 
-        new AggregatingResourceLoader("test.xml", 
-                                      new String[]
-                                      {
-                                        "test-1.xml",
-                                        "test-exception.xml",
-                                        "test-2.xml"
-                                      },
-                                      new ThrowingResourceLoader());
-      loader.setSeparator("\n");
-      doTestContentLength(loader.getResource("test.xml"));
-      //always log an error here.
-      assertTrue("Expected IOException was not thrown.", false);
-    }
-    catch (IOException e)
-    {
-      if (!"This test exception is expected".equals(e.getMessage()))
-      {
-        throw new IOException(e.getMessage());
-      }
-    }
-  }
-
-  public void testUnknownContentLength() throws IOException
-  {
-    AggregatingResourceLoader loader = 
-      new AggregatingResourceLoader("test.xml", 
-                                    new String[]
-                                    {
-                                      "test-1.xml",
-                                      "unknown-length.xml",
-                                      "test-2.xml"
-                                    },
-                                    new UnknownLengthResourceLoader());
-    loader.setSeparator("\n");
-    doTestUnknownContentLength(loader.getResource("test.xml"));
-  }
-
-  private class ThrowingResourceLoader extends LocalResourceLoader
-  {
-    protected URL findResource(
-      String name
-      ) throws IOException
-    {
-      if ("test-exception.xml".equals(name))
-        throw new IOException("This test exception is expected");
-        
-      return super.findResource(name);
-    }
-  }
-
-  private class UnknownLengthResourceLoader extends LocalResourceLoader
-  {
-    protected URL findResource(
-      String name
-      ) throws IOException
-    {
-      if ("unknown-length.xml".equals(name))
-        return new URL(super.findResource("test-1.xml"), name,
-                       new UnknownLengthStreamHandler());
-        
-      return super.findResource(name);
-    }
-  }
-  
-  private class UnknownLengthStreamHandler extends URLStreamHandler
-  {
-    protected URLConnection openConnection(
-      URL url
-      ) throws IOException
-    {
-      return new UnknownLengthURLConnection(url);
-    }
-    
-  }
-
-  private class UnknownLengthURLConnection extends URLConnection
-  {
-    public UnknownLengthURLConnection(
-      URL url)
-    {
-      super(url);
-    }
-    
-    public int getContentLength()
-    {
-      return -1;
-    }
-
-    public void connect() throws IOException
-    {
-      // no-op
-    }
-
-    public InputStream getInputStream() throws IOException
-    {
-      return new ByteArrayInputStream(new byte[0]);
-    }
-  }
-}
+package org.apache.myfaces.adf.resource;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+
+public class AggregatingResourceLoaderTest extends ResourceLoaderTestCase
+{
+  public AggregatingResourceLoaderTest(
+    String testName)
+  {
+    super(testName);
+  }
+
+  public void testContentLength() throws IOException
+  {
+    ResourceLoader loader = 
+      new AggregatingResourceLoader("test.xml", 
+                                    new String[]
+                                    {
+                                      "test-1.xml",
+                                      "test-2.xml"
+                                    },
+                                    new LocalResourceLoader());
+    doTestContentLength(loader.getResource("test.xml"));
+  }
+
+  public void testContentLengthWithException() throws IOException
+  {
+    try
+    {
+      AggregatingResourceLoader loader = 
+        new AggregatingResourceLoader("test.xml", 
+                                      new String[]
+                                      {
+                                        "test-1.xml",
+                                        "test-exception.xml",
+                                        "test-2.xml"
+                                      },
+                                      new ThrowingResourceLoader());
+      loader.setSeparator("\n");
+      doTestContentLength(loader.getResource("test.xml"));
+      //always log an error here.
+      assertTrue("Expected IOException was not thrown.", false);
+    }
+    catch (IOException e)
+    {
+      if (!"This test exception is expected".equals(e.getMessage()))
+      {
+        throw new IOException(e.getMessage());
+      }
+    }
+  }
+
+  public void testUnknownContentLength() throws IOException
+  {
+    AggregatingResourceLoader loader = 
+      new AggregatingResourceLoader("test.xml", 
+                                    new String[]
+                                    {
+                                      "test-1.xml",
+                                      "unknown-length.xml",
+                                      "test-2.xml"
+                                    },
+                                    new UnknownLengthResourceLoader());
+    loader.setSeparator("\n");
+    doTestUnknownContentLength(loader.getResource("test.xml"));
+  }
+
+  private class ThrowingResourceLoader extends LocalResourceLoader
+  {
+    protected URL findResource(
+      String name
+      ) throws IOException
+    {
+      if ("test-exception.xml".equals(name))
+        throw new IOException("This test exception is expected");
+        
+      return super.findResource(name);
+    }
+  }
+
+  private class UnknownLengthResourceLoader extends LocalResourceLoader
+  {
+    protected URL findResource(
+      String name
+      ) throws IOException
+    {
+      if ("unknown-length.xml".equals(name))
+        return new URL(super.findResource("test-1.xml"), name,
+                       new UnknownLengthStreamHandler());
+        
+      return super.findResource(name);
+    }
+  }
+  
+  private class UnknownLengthStreamHandler extends URLStreamHandler
+  {
+    protected URLConnection openConnection(
+      URL url
+      ) throws IOException
+    {
+      return new UnknownLengthURLConnection(url);
+    }
+    
+  }
+
+  private class UnknownLengthURLConnection extends URLConnection
+  {
+    public UnknownLengthURLConnection(
+      URL url)
+    {
+      super(url);
+    }
+    
+    public int getContentLength()
+    {
+      return -1;
+    }
+
+    public void connect() throws IOException
+    {
+      // no-op
+    }
+
+    public InputStream getInputStream() throws IOException
+    {
+      return new ByteArrayInputStream(new byte[0]);
+    }
+  }
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/resource/AggregatingResourceLoaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/resource/CachingResourceLoaderTest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/resource/CachingResourceLoaderTest.java?rev=425268&r1=425267&r2=425268&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/resource/CachingResourceLoaderTest.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/resource/CachingResourceLoaderTest.java Mon Jul 24 20:54:50 2006
@@ -13,33 +13,33 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-package org.apache.myfaces.adf.resource;
-
-import java.io.IOException;
-import java.net.URL;
-
-public class CachingResourceLoaderTest extends ResourceLoaderTestCase
-{
-  public CachingResourceLoaderTest(
-    String testName)
-  {
-    super(testName);
-  }
-
-  public void testContentLength() throws IOException
-  {
-    // test twice to make sure both codepaths work
-    // 1. initial load
-    // 2. cached content
-    URL url = findTestResource();
-    doTestContentLength(url);
-    doTestContentLength(url);
-  }
-
-  protected URL findTestResource() throws IOException
-  {
-    ResourceLoader loader = 
-      new CachingResourceLoader(new LocalResourceLoader());
-    return loader.getResource("test.xml");
-  }
-}
+package org.apache.myfaces.adf.resource;
+
+import java.io.IOException;
+import java.net.URL;
+
+public class CachingResourceLoaderTest extends ResourceLoaderTestCase
+{
+  public CachingResourceLoaderTest(
+    String testName)
+  {
+    super(testName);
+  }
+
+  public void testContentLength() throws IOException
+  {
+    // test twice to make sure both codepaths work
+    // 1. initial load
+    // 2. cached content
+    URL url = findTestResource();
+    doTestContentLength(url);
+    doTestContentLength(url);
+  }
+
+  protected URL findTestResource() throws IOException
+  {
+    ResourceLoader loader = 
+      new CachingResourceLoader(new LocalResourceLoader());
+    return loader.getResource("test.xml");
+  }
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/resource/CachingResourceLoaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/resource/ResourceLoaderTestCase.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/resource/ResourceLoaderTestCase.java?rev=425268&r1=425267&r2=425268&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/resource/ResourceLoaderTestCase.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/resource/ResourceLoaderTestCase.java Mon Jul 24 20:54:50 2006
@@ -13,70 +13,70 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-package org.apache.myfaces.adf.resource;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import junit.framework.TestCase;
-
-abstract public class ResourceLoaderTestCase extends TestCase
-{
-  public ResourceLoaderTestCase(
-    String testName)
-  {
-    super(testName);
-  }
-
-  protected void doTestUnknownContentLength(
-    URL url) throws IOException
-  {
-    URLConnection conn = url.openConnection();
-    long actualContentLength = conn.getContentLength();
-
-    assertEquals("Invalid explicit content length",
-                 -1L, actualContentLength);
-  }
-  
-  protected void doTestContentLength(
-    URL url) throws IOException
-  {
-    URLConnection conn = url.openConnection();
-    long expectedContentLength = conn.getContentLength();
-
-    if (expectedContentLength != -1)
-    {
-      byte[] buffer = new byte[2048];
-      InputStream in = conn.getInputStream();
-  
-      try
-      {
-        long actualContentLength = 0;
-    
-        int length;
-        while ((length = (in.read(buffer))) >= 0)
-        {
-          actualContentLength += length;
-        }
-  
-        assertEquals("Inaccurate explicit content length",
-                     expectedContentLength, actualContentLength);
-      }
-      finally
-      {
-        in.close();
-      }
-    }
-  }
-
-  public class LocalResourceLoader extends ResourceLoader
-  {
-    protected URL findResource(
-      String name
-      ) throws IOException
-    {
-      return getClass().getResource(name);
-    }
-  }
-}
+package org.apache.myfaces.adf.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import junit.framework.TestCase;
+
+abstract public class ResourceLoaderTestCase extends TestCase
+{
+  public ResourceLoaderTestCase(
+    String testName)
+  {
+    super(testName);
+  }
+
+  protected void doTestUnknownContentLength(
+    URL url) throws IOException
+  {
+    URLConnection conn = url.openConnection();
+    long actualContentLength = conn.getContentLength();
+
+    assertEquals("Invalid explicit content length",
+                 -1L, actualContentLength);
+  }
+  
+  protected void doTestContentLength(
+    URL url) throws IOException
+  {
+    URLConnection conn = url.openConnection();
+    long expectedContentLength = conn.getContentLength();
+
+    if (expectedContentLength != -1)
+    {
+      byte[] buffer = new byte[2048];
+      InputStream in = conn.getInputStream();
+  
+      try
+      {
+        long actualContentLength = 0;
+    
+        int length;
+        while ((length = (in.read(buffer))) >= 0)
+        {
+          actualContentLength += length;
+        }
+  
+        assertEquals("Inaccurate explicit content length",
+                     expectedContentLength, actualContentLength);
+      }
+      finally
+      {
+        in.close();
+      }
+    }
+  }
+
+  public class LocalResourceLoader extends ResourceLoader
+  {
+    protected URL findResource(
+      String name
+      ) throws IOException
+    {
+      return getClass().getResource(name);
+    }
+  }
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/resource/ResourceLoaderTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/util/Base64InputStreamTest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/util/Base64InputStreamTest.java?rev=425268&r1=425267&r2=425268&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/util/Base64InputStreamTest.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/util/Base64InputStreamTest.java Mon Jul 24 20:54:50 2006
@@ -13,35 +13,35 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-
-package org.apache.myfaces.adf.util;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.BufferedReader;
+
+package org.apache.myfaces.adf.util;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.BufferedReader;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
-
-import org.apache.myfaces.adfbuild.test.FacesTestCase;
-
-/**
- * Unit tests for Base64InputStream.
- * 
- * @author Matthew Lee
- */
-
-public class Base64InputStreamTest extends FacesTestCase 
-{   
-	
-  /**
-   * Creates a new Base64InputStreamTest.
-   * 
-   * @param testName  the unit test name
-   */	
- 	public Base64InputStreamTest(String testName)
-  	{
-  	  super(testName);
+
+import org.apache.myfaces.adfbuild.test.FacesTestCase;
+
+/**
+ * Unit tests for Base64InputStream.
+ * 
+ * @author Matthew Lee
+ */
+
+public class Base64InputStreamTest extends FacesTestCase 
+{   
+	
+  /**
+   * Creates a new Base64InputStreamTest.
+   * 
+   * @param testName  the unit test name
+   */	
+ 	public Base64InputStreamTest(String testName)
+  	{
+  	  super(testName);
  	}
   
   public void setUp()
@@ -57,75 +57,75 @@
   public static Test suite()
   {
     return new TestSuite(Base64InputStreamTest.class);
-  }
-	
-  /**
-   * Tests decoding of stream that contains no trailing padding characters.
-   */
- 	public void testNoPaddingChar() throws IOException
- 	{
-		String	str = "abcdefghijklmnopqrstuvwxBase64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way. 1";
-    	String str_encoded = "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4QmFzZTY0IEVuY29kaW5nIGlzIGEgcG9wdWxhciB3YXkgdG8gY29udmVydCB0aGUgOGJpdCBhbmQgdGhlIGJpbmFyeSB0byB0aGUgN2JpdCBmb3IgbmV0d29yayB0cmFucyB1c2luZyBTb2NrZXQsIGFuZCBhIHNlY3VyaXR5IG1ldGhvZCB0byBoYW5kbGUgdGV4dCBvciBmaWxlLCBvZnRlbiB1c2VkIGluIEF1dGhlbnRpY2FsIExvZ2luIGFuZCBNYWlsIEF0dGFjaG1lbnQsIGFsc28gc3RvcmVkIGluIHRleHQgZmlsZSBvciBkYXRhYmFzZS4gTW9zdCBTTVRQIHNlcnZlciB3aWxsIGhhbmRsZSB0aGUgbG9naW4gVXNlck5hbWUgYW5kIFBhc3N3b3JkIGluIHRoaXMgd2F5LiAx";
-  
-    	_testRead(str, str_encoded);	
-    	
- 	}
- 	
-  /**
-   * Tests decoding of stream that contains exactly one trailing padding character.
-   */
- 	public void testOnePaddingChar() throws IOException
- 	{
-		String str = "Base64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way.9";
-    	String str_encoded = "QmFzZTY0IEVuY29kaW5nIGlzIGEgcG9wdWxhciB3YXkgdG8gY29udmVydCB0aGUgOGJpdCBhbmQgdGhlIGJpbmFyeSB0byB0aGUgN2JpdCBmb3IgbmV0d29yayB0cmFucyB1c2luZyBTb2NrZXQsIGFuZCBhIHNlY3VyaXR5IG1ldGhvZCB0byBoYW5kbGUgdGV4dCBvciBmaWxlLCBvZnRlbiB1c2VkIGluIEF1dGhlbnRpY2FsIExvZ2luIGFuZCBNYWlsIEF0dGFjaG1lbnQsIGFsc28gc3RvcmVkIGluIHRleHQgZmlsZSBvciBkYXRhYmFzZS4gTW9zdCBTTVRQIHNlcnZlciB3aWxsIGhhbmRsZSB0aGUgbG9naW4gVXNlck5hbWUgYW5kIFBhc3N3b3JkIGluIHRoaXMgd2F5Ljk="; 
-   
-		_testRead(str, str_encoded); 	
-    	
- 	}
- 	
-   /**
-   * Tests decoding of stream that contains exactly two trailing padding characters.
-   */	 	
-  	public void testTwoPaddingChars() throws IOException
- 	{
-    	String str = "Base64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way.";
-    	String str_encoded = "QmFzZTY0IEVuY29kaW5nIGlzIGEgcG9wdWxhciB3YXkgdG8gY29udmVydCB0aGUgOGJpdCBhbmQgdGhlIGJpbmFyeSB0byB0aGUgN2JpdCBmb3IgbmV0d29yayB0cmFucyB1c2luZyBTb2NrZXQsIGFuZCBhIHNlY3VyaXR5IG1ldGhvZCB0byBoYW5kbGUgdGV4dCBvciBmaWxlLCBvZnRlbiB1c2VkIGluIEF1dGhlbnRpY2FsIExvZ2luIGFuZCBNYWlsIEF0dGFjaG1lbnQsIGFsc28gc3RvcmVkIGluIHRleHQgZmlsZSBvciBkYXRhYmFzZS4gTW9zdCBTTVRQIHNlcnZlciB3aWxsIGhhbmRsZSB0aGUgbG9naW4gVXNlck5hbWUgYW5kIFBhc3N3b3JkIGluIHRoaXMgd2F5Lg==";
-    
-		_testRead(str, str_encoded); 	
-    	
- 	}	
- 	
- 	
-	/**
-	 *
-	 *	Uses Base64InputStream to reads from the encoded string and 
-	 *	compares output with the expected decoded string.
-	 *
-	 *	@param	str			the decoded string
-	 *	@param  str_encoded	the base64 encoded string
-	 * 
-	 **/ 	
- 	
-	private void _testRead(String str, String str_encoded) throws IOException
-	{
-   
-	    // construct the Base64InputStream from the encoded string
-	    StringReader strreader = new StringReader(str_encoded);
-	    BufferedReader buffreader = new BufferedReader(strreader); 
-	    Base64InputStream b64_in = new Base64InputStream(buffreader);
- 
-	    // read decoded chars from the Base64InputStream and form decoded string
- 	   	String result = "";
- 	   	int c;
- 	   	while ( (c = b64_in.read()) != -1 ) 
- 	   	{
-  	   	 result = result + (char)c;
-  	 	}
-  	 	
-		// compare resulting decoded string with the expected decoded string 
-		assertEquals(result, str);	
-	}
-  
-  
-  
-} // end Base64InputStreamTest class
+  }
+	
+  /**
+   * Tests decoding of stream that contains no trailing padding characters.
+   */
+ 	public void testNoPaddingChar() throws IOException
+ 	{
+		String	str = "abcdefghijklmnopqrstuvwxBase64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way. 1";
+    	String str_encoded = "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4QmFzZTY0IEVuY29kaW5nIGlzIGEgcG9wdWxhciB3YXkgdG8gY29udmVydCB0aGUgOGJpdCBhbmQgdGhlIGJpbmFyeSB0byB0aGUgN2JpdCBmb3IgbmV0d29yayB0cmFucyB1c2luZyBTb2NrZXQsIGFuZCBhIHNlY3VyaXR5IG1ldGhvZCB0byBoYW5kbGUgdGV4dCBvciBmaWxlLCBvZnRlbiB1c2VkIGluIEF1dGhlbnRpY2FsIExvZ2luIGFuZCBNYWlsIEF0dGFjaG1lbnQsIGFsc28gc3RvcmVkIGluIHRleHQgZmlsZSBvciBkYXRhYmFzZS4gTW9zdCBTTVRQIHNlcnZlciB3aWxsIGhhbmRsZSB0aGUgbG9naW4gVXNlck5hbWUgYW5kIFBhc3N3b3JkIGluIHRoaXMgd2F5LiAx";
+  
+    	_testRead(str, str_encoded);	
+    	
+ 	}
+ 	
+  /**
+   * Tests decoding of stream that contains exactly one trailing padding character.
+   */
+ 	public void testOnePaddingChar() throws IOException
+ 	{
+		String str = "Base64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way.9";
+    	String str_encoded = "QmFzZTY0IEVuY29kaW5nIGlzIGEgcG9wdWxhciB3YXkgdG8gY29udmVydCB0aGUgOGJpdCBhbmQgdGhlIGJpbmFyeSB0byB0aGUgN2JpdCBmb3IgbmV0d29yayB0cmFucyB1c2luZyBTb2NrZXQsIGFuZCBhIHNlY3VyaXR5IG1ldGhvZCB0byBoYW5kbGUgdGV4dCBvciBmaWxlLCBvZnRlbiB1c2VkIGluIEF1dGhlbnRpY2FsIExvZ2luIGFuZCBNYWlsIEF0dGFjaG1lbnQsIGFsc28gc3RvcmVkIGluIHRleHQgZmlsZSBvciBkYXRhYmFzZS4gTW9zdCBTTVRQIHNlcnZlciB3aWxsIGhhbmRsZSB0aGUgbG9naW4gVXNlck5hbWUgYW5kIFBhc3N3b3JkIGluIHRoaXMgd2F5Ljk="; 
+   
+		_testRead(str, str_encoded); 	
+    	
+ 	}
+ 	
+   /**
+   * Tests decoding of stream that contains exactly two trailing padding characters.
+   */	 	
+  	public void testTwoPaddingChars() throws IOException
+ 	{
+    	String str = "Base64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way.";
+    	String str_encoded = "QmFzZTY0IEVuY29kaW5nIGlzIGEgcG9wdWxhciB3YXkgdG8gY29udmVydCB0aGUgOGJpdCBhbmQgdGhlIGJpbmFyeSB0byB0aGUgN2JpdCBmb3IgbmV0d29yayB0cmFucyB1c2luZyBTb2NrZXQsIGFuZCBhIHNlY3VyaXR5IG1ldGhvZCB0byBoYW5kbGUgdGV4dCBvciBmaWxlLCBvZnRlbiB1c2VkIGluIEF1dGhlbnRpY2FsIExvZ2luIGFuZCBNYWlsIEF0dGFjaG1lbnQsIGFsc28gc3RvcmVkIGluIHRleHQgZmlsZSBvciBkYXRhYmFzZS4gTW9zdCBTTVRQIHNlcnZlciB3aWxsIGhhbmRsZSB0aGUgbG9naW4gVXNlck5hbWUgYW5kIFBhc3N3b3JkIGluIHRoaXMgd2F5Lg==";
+    
+		_testRead(str, str_encoded); 	
+    	
+ 	}	
+ 	
+ 	
+	/**
+	 *
+	 *	Uses Base64InputStream to reads from the encoded string and 
+	 *	compares output with the expected decoded string.
+	 *
+	 *	@param	str			the decoded string
+	 *	@param  str_encoded	the base64 encoded string
+	 * 
+	 **/ 	
+ 	
+	private void _testRead(String str, String str_encoded) throws IOException
+	{
+   
+	    // construct the Base64InputStream from the encoded string
+	    StringReader strreader = new StringReader(str_encoded);
+	    BufferedReader buffreader = new BufferedReader(strreader); 
+	    Base64InputStream b64_in = new Base64InputStream(buffreader);
+ 
+	    // read decoded chars from the Base64InputStream and form decoded string
+ 	   	String result = "";
+ 	   	int c;
+ 	   	while ( (c = b64_in.read()) != -1 ) 
+ 	   	{
+  	   	 result = result + (char)c;
+  	 	}
+  	 	
+		// compare resulting decoded string with the expected decoded string 
+		assertEquals(result, str);	
+	}
+  
+  
+  
+} // end Base64InputStreamTest class

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/util/Base64InputStreamTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/util/Base64OutputStreamTest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/util/Base64OutputStreamTest.java?rev=425268&r1=425267&r2=425268&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/util/Base64OutputStreamTest.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/util/Base64OutputStreamTest.java Mon Jul 24 20:54:50 2006
@@ -13,36 +13,36 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-
-package org.apache.myfaces.adf.util;
-
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.BufferedWriter;
-import java.util.zip.GZIPOutputStream;
+
+package org.apache.myfaces.adf.util;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.BufferedWriter;
+import java.util.zip.GZIPOutputStream;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
-
-import org.apache.myfaces.adfbuild.test.FacesTestCase;
-
-/**
- * Unit tests for Base64OutputStream.
- * 
- * @author Matthew Lee
- */
-public class Base64OutputStreamTest extends FacesTestCase 
-{   
- /**
-   * Creates a new Base64OutputStreamTest.
-   * 
-   * @param testName  the unit test name
-   */
- 	public Base64OutputStreamTest(String testName)
-  	{
-  	  super(testName);
+
+import org.apache.myfaces.adfbuild.test.FacesTestCase;
+
+/**
+ * Unit tests for Base64OutputStream.
+ * 
+ * @author Matthew Lee
+ */
+public class Base64OutputStreamTest extends FacesTestCase 
+{   
+ /**
+   * Creates a new Base64OutputStreamTest.
+   * 
+   * @param testName  the unit test name
+   */
+ 	public Base64OutputStreamTest(String testName)
+  	{
+  	  super(testName);
  	}
-  
+  
   public void setUp()
   {
     super.setUp();
@@ -57,193 +57,193 @@
   {
     return new TestSuite(Base64OutputStreamTest.class);
   }
-  
-  /**
-   * Tests decoding of stream that contains no trailing padding characters.
-   */ 	
- 	public void testNoPaddingChar() throws IOException
- 	{
-	 	
-		String	str = "abcdefghijklmnopqrstuvwxBase64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way. 1";
-    	String str_encoded = "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4QmFzZTY0IEVuY29kaW5nIGlzIGEgcG9wdWxhciB3YXkgdG8gY29udmVydCB0aGUgOGJpdCBhbmQgdGhlIGJpbmFyeSB0byB0aGUgN2JpdCBmb3IgbmV0d29yayB0cmFucyB1c2luZyBTb2NrZXQsIGFuZCBhIHNlY3VyaXR5IG1ldGhvZCB0byBoYW5kbGUgdGV4dCBvciBmaWxlLCBvZnRlbiB1c2VkIGluIEF1dGhlbnRpY2FsIExvZ2luIGFuZCBNYWlsIEF0dGFjaG1lbnQsIGFsc28gc3RvcmVkIGluIHRleHQgZmlsZSBvciBkYXRhYmFzZS4gTW9zdCBTTVRQIHNlcnZlciB3aWxsIGhhbmRsZSB0aGUgbG9naW4gVXNlck5hbWUgYW5kIFBhc3N3b3JkIGluIHRoaXMgd2F5LiAx";
-   
-    	_testWriteChar(str, str_encoded);
-    	
-    	_testWriteArray(str, str_encoded);    	
-    	
- 	}
- 	
-  /**
-   * Tests decoding of stream that contains exactly one trailing padding character.
-   */ 	
- 	public void testOnePaddingChar() throws IOException
- 	{
-		String str = "Base64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way.9";
-    	String str_encoded = "QmFzZTY0IEVuY29kaW5nIGlzIGEgcG9wdWxhciB3YXkgdG8gY29udmVydCB0aGUgOGJpdCBhbmQgdGhlIGJpbmFyeSB0byB0aGUgN2JpdCBmb3IgbmV0d29yayB0cmFucyB1c2luZyBTb2NrZXQsIGFuZCBhIHNlY3VyaXR5IG1ldGhvZCB0byBoYW5kbGUgdGV4dCBvciBmaWxlLCBvZnRlbiB1c2VkIGluIEF1dGhlbnRpY2FsIExvZ2luIGFuZCBNYWlsIEF0dGFjaG1lbnQsIGFsc28gc3RvcmVkIGluIHRleHQgZmlsZSBvciBkYXRhYmFzZS4gTW9zdCBTTVRQIHNlcnZlciB3aWxsIGhhbmRsZSB0aGUgbG9naW4gVXNlck5hbWUgYW5kIFBhc3N3b3JkIGluIHRoaXMgd2F5Ljk="; 
-   
-    	_testWriteChar(str, str_encoded);
-    	
-    	_testWriteArray(str, str_encoded);    	
-    	
- 	}
- 	
-   /**
-   * Tests decoding of stream that contains exactly two trailing padding characters.
-   */ 	 	
-  	public void testTwoPaddingChars() throws IOException
- 	{
-    	String str = "Base64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way.";
-    	String str_encoded = "QmFzZTY0IEVuY29kaW5nIGlzIGEgcG9wdWxhciB3YXkgdG8gY29udmVydCB0aGUgOGJpdCBhbmQgdGhlIGJpbmFyeSB0byB0aGUgN2JpdCBmb3IgbmV0d29yayB0cmFucyB1c2luZyBTb2NrZXQsIGFuZCBhIHNlY3VyaXR5IG1ldGhvZCB0byBoYW5kbGUgdGV4dCBvciBmaWxlLCBvZnRlbiB1c2VkIGluIEF1dGhlbnRpY2FsIExvZ2luIGFuZCBNYWlsIEF0dGFjaG1lbnQsIGFsc28gc3RvcmVkIGluIHRleHQgZmlsZSBvciBkYXRhYmFzZS4gTW9zdCBTTVRQIHNlcnZlciB3aWxsIGhhbmRsZSB0aGUgbG9naW4gVXNlck5hbWUgYW5kIFBhc3N3b3JkIGluIHRoaXMgd2F5Lg==";
-    
-    	_testWriteChar(str, str_encoded);
-    	
-    	_testWriteArray(str, str_encoded);    	
-    	
- 	}	
- 	
-  /**
-   * Tests decoding of stream by writing out to stream in different intervals to test whether
-   * whehther leftover data is persisted across calls to write
-   */ 	 	
-  	public void testMultipleWrites() throws IOException
- 	{
-    	String str = "Base64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way.";
-    	String str_encoded = "QmFzZTY0IEVuY29kaW5nIGlzIGEgcG9wdWxhciB3YXkgdG8gY29udmVydCB0aGUgOGJpdCBhbmQgdGhlIGJpbmFyeSB0byB0aGUgN2JpdCBmb3IgbmV0d29yayB0cmFucyB1c2luZyBTb2NrZXQsIGFuZCBhIHNlY3VyaXR5IG1ldGhvZCB0byBoYW5kbGUgdGV4dCBvciBmaWxlLCBvZnRlbiB1c2VkIGluIEF1dGhlbnRpY2FsIExvZ2luIGFuZCBNYWlsIEF0dGFjaG1lbnQsIGFsc28gc3RvcmVkIGluIHRleHQgZmlsZSBvciBkYXRhYmFzZS4gTW9zdCBTTVRQIHNlcnZlciB3aWxsIGhhbmRsZSB0aGUgbG9naW4gVXNlck5hbWUgYW5kIFBhc3N3b3JkIGluIHRoaXMgd2F5Lg==";
-    
-    	// create a Base64OutputStream 
-    	StringWriter strwriter = new StringWriter(); 
-    	BufferedWriter buffwriter = new BufferedWriter(strwriter);
-    	Base64OutputStream b64_out = new Base64OutputStream(buffwriter);
-    	
-    	byte[] b = str.getBytes();
-    
-		// write the bytes in different lengths to test whether leftover
-		// data is persisted across calls to write
-	    b64_out.write(b, 0, 33);
-	    b64_out.write(b, 33, 1);
-	    b64_out.write(b, 34, 1);
-	    b64_out.write(b, 35, 2);
-	    b64_out.write(b, 37, 3);
-	    b64_out.write(b, 40, 3);
-	    b64_out.write(b, 43, 3);
-	    b64_out.write(b, 46, 5);
-	    b64_out.write(b, 51, 4);
-	    b64_out.write(b, 55, 5);
-	    b64_out.write(b, 60, 6);
-	    b64_out.write(b, 66, 10);
-	    b64_out.write(b, 76, 51);
-	    b64_out.write(b, 127, 150);
-	    b64_out.write(b, 277, 22);
-	    b64_out.write(b, 299, 21);
-	    b64_out.write(b, 320, 2);
-	    	    
-    	// remember to add padding characters (if necessary)
-    	b64_out.finish();
-    	  	
-    	buffwriter.flush();
-		
-    	// compare the contents of the outputstream with the expected encoded string
-		assertEquals(strwriter.toString(), str_encoded);	
- 	}	
- 	
- 	
-  /**
-   * Testing writing binary data whose byte values range from -128 to 128.
-   * We create such data by GZIP-ing the string before writing out to the Base64OutputStream.
-   * 
-   */ 	 	
-  	public void testWriteBinaryData() throws IOException
- 	{
- 	  String str = "Base64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way.";
-	  String str_encoded = "H4sIAAAAAAAAAD2QQW7DMAwEv7IPCHIK2l4ToLe6CJD2AbREx0JkMpDouvl9KQXokVxylssTVX454F2CxiRXpArCXe9rpoKNHjBFUPnhYrCZ8TYmA0nsxZiESh9p1WuTJi0Qtk3LDVZIKtbauBcNN7ZdXyVUDmtJ9sDCNmtshNmVzDD+NThjSpl30MlYnMARSXBc3UYsBcr40Kt3Gm2glHE0ozAvrrpFropqWp5bndhwDRvJaPTIewxaDZfh6+zHFI+HLeX8f4XHyd3h29VPWrhbnalWT/bEzv4qf9D+DzA2UNlCAQAA";
- 	  
- 	  byte[] bytes = str.getBytes();
- 	  
- 	  StringWriter strwriter = new StringWriter(); 
-      BufferedWriter buffwriter = new BufferedWriter(strwriter);
-      Base64OutputStream b64_out = new Base64OutputStream(buffwriter);
-
-      GZIPOutputStream zip = new GZIPOutputStream(b64_out);
-      
-      zip.write(bytes, 0, bytes.length);
-      zip.finish();
-      buffwriter.flush();
-      b64_out.finish();
-      
-      assertEquals(str_encoded, strwriter.toString());
-	 	
- 	}
-    
-	 	
- ////////// private	methods ////////////
- 	
-	/**
-	 *
-	 *	Writes each individual char from str to a Base64OutputStream and compares
-	 *	the resulting output stream contents with the expected encoded string.  
-	 *
-	 *	@param	str			the decoded string
-	 *	@param	str_encoded	the encoded string
-	 *
-	 **/ 	
- 	
-	private void _testWriteChar(String str, String str_encoded) throws IOException
-	{
-		// create a Base64OutputStream 
-    	StringWriter strwriter = new StringWriter(); 
-    	BufferedWriter buffwriter = new BufferedWriter(strwriter);
-    	Base64OutputStream b64_out = new Base64OutputStream(buffwriter);
-    
-    	// write out each char in str to the stream
-    	for (int i = 0; i<str.length(); i++) 
-    	{
-     	 b64_out.write((int)str.charAt(i));
-    	}
-    	// remember to add padding characters (if necessary)
-    	b64_out.finish();
-    	
-    	
-    	buffwriter.flush();
-		
-    	// compare the contents of the outputstream with the expected encoded string
-		assertEquals(strwriter.toString(), str_encoded);	
-	}
- 	
-	/**
-	 *
-	 *	Writes str (after converting to an array of bytes) to a Base64OutputStream 
-	 *	and compares the resulting output stream contents with the expected encoded 
-	 *	string.  
-	 *
-	 *	@param	str			the decoded string
-	 *	@param	str_encoded	the encoded string
-	 *
-	 **/ 	
-	private void _testWriteArray(String str, String str_encoded) throws IOException
-	{	
-		// create a Base64OutputStream 
-    	StringWriter strwriter = new StringWriter(); 
-    	BufferedWriter buffwriter = new BufferedWriter(strwriter);
-    	Base64OutputStream b64_out = new Base64OutputStream(buffwriter);
-  
-    	// convert str into an array of bytes
-    	byte[] b = str.getBytes();
-    	
-    	// write out the array to the output stream
-    	b64_out.write(b, 0, b.length);
-    	// append padding chars if necessary
-    	b64_out.finish();
-    
-    	buffwriter.flush();
-    	
-// 		System.out.println("testwriteArray,  expected encoding:" + str_encoded);    
-//       	System.out.println("testwriteArray, output of encoding:" + strwriter.toString());
- 
-    	// compare the contents of the outputstream with the expected encoded string
-    	assertEquals(strwriter.toString(), str_encoded);
-	}
-
-  
-  
-  
-} // end Base64OutputStreamTest class
+  
+  /**
+   * Tests decoding of stream that contains no trailing padding characters.
+   */ 	
+ 	public void testNoPaddingChar() throws IOException
+ 	{
+	 	
+		String	str = "abcdefghijklmnopqrstuvwxBase64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way. 1";
+    	String str_encoded = "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4QmFzZTY0IEVuY29kaW5nIGlzIGEgcG9wdWxhciB3YXkgdG8gY29udmVydCB0aGUgOGJpdCBhbmQgdGhlIGJpbmFyeSB0byB0aGUgN2JpdCBmb3IgbmV0d29yayB0cmFucyB1c2luZyBTb2NrZXQsIGFuZCBhIHNlY3VyaXR5IG1ldGhvZCB0byBoYW5kbGUgdGV4dCBvciBmaWxlLCBvZnRlbiB1c2VkIGluIEF1dGhlbnRpY2FsIExvZ2luIGFuZCBNYWlsIEF0dGFjaG1lbnQsIGFsc28gc3RvcmVkIGluIHRleHQgZmlsZSBvciBkYXRhYmFzZS4gTW9zdCBTTVRQIHNlcnZlciB3aWxsIGhhbmRsZSB0aGUgbG9naW4gVXNlck5hbWUgYW5kIFBhc3N3b3JkIGluIHRoaXMgd2F5LiAx";
+   
+    	_testWriteChar(str, str_encoded);
+    	
+    	_testWriteArray(str, str_encoded);    	
+    	
+ 	}
+ 	
+  /**
+   * Tests decoding of stream that contains exactly one trailing padding character.
+   */ 	
+ 	public void testOnePaddingChar() throws IOException
+ 	{
+		String str = "Base64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way.9";
+    	String str_encoded = "QmFzZTY0IEVuY29kaW5nIGlzIGEgcG9wdWxhciB3YXkgdG8gY29udmVydCB0aGUgOGJpdCBhbmQgdGhlIGJpbmFyeSB0byB0aGUgN2JpdCBmb3IgbmV0d29yayB0cmFucyB1c2luZyBTb2NrZXQsIGFuZCBhIHNlY3VyaXR5IG1ldGhvZCB0byBoYW5kbGUgdGV4dCBvciBmaWxlLCBvZnRlbiB1c2VkIGluIEF1dGhlbnRpY2FsIExvZ2luIGFuZCBNYWlsIEF0dGFjaG1lbnQsIGFsc28gc3RvcmVkIGluIHRleHQgZmlsZSBvciBkYXRhYmFzZS4gTW9zdCBTTVRQIHNlcnZlciB3aWxsIGhhbmRsZSB0aGUgbG9naW4gVXNlck5hbWUgYW5kIFBhc3N3b3JkIGluIHRoaXMgd2F5Ljk="; 
+   
+    	_testWriteChar(str, str_encoded);
+    	
+    	_testWriteArray(str, str_encoded);    	
+    	
+ 	}
+ 	
+   /**
+   * Tests decoding of stream that contains exactly two trailing padding characters.
+   */ 	 	
+  	public void testTwoPaddingChars() throws IOException
+ 	{
+    	String str = "Base64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way.";
+    	String str_encoded = "QmFzZTY0IEVuY29kaW5nIGlzIGEgcG9wdWxhciB3YXkgdG8gY29udmVydCB0aGUgOGJpdCBhbmQgdGhlIGJpbmFyeSB0byB0aGUgN2JpdCBmb3IgbmV0d29yayB0cmFucyB1c2luZyBTb2NrZXQsIGFuZCBhIHNlY3VyaXR5IG1ldGhvZCB0byBoYW5kbGUgdGV4dCBvciBmaWxlLCBvZnRlbiB1c2VkIGluIEF1dGhlbnRpY2FsIExvZ2luIGFuZCBNYWlsIEF0dGFjaG1lbnQsIGFsc28gc3RvcmVkIGluIHRleHQgZmlsZSBvciBkYXRhYmFzZS4gTW9zdCBTTVRQIHNlcnZlciB3aWxsIGhhbmRsZSB0aGUgbG9naW4gVXNlck5hbWUgYW5kIFBhc3N3b3JkIGluIHRoaXMgd2F5Lg==";
+    
+    	_testWriteChar(str, str_encoded);
+    	
+    	_testWriteArray(str, str_encoded);    	
+    	
+ 	}	
+ 	
+  /**
+   * Tests decoding of stream by writing out to stream in different intervals to test whether
+   * whehther leftover data is persisted across calls to write
+   */ 	 	
+  	public void testMultipleWrites() throws IOException
+ 	{
+    	String str = "Base64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way.";
+    	String str_encoded = "QmFzZTY0IEVuY29kaW5nIGlzIGEgcG9wdWxhciB3YXkgdG8gY29udmVydCB0aGUgOGJpdCBhbmQgdGhlIGJpbmFyeSB0byB0aGUgN2JpdCBmb3IgbmV0d29yayB0cmFucyB1c2luZyBTb2NrZXQsIGFuZCBhIHNlY3VyaXR5IG1ldGhvZCB0byBoYW5kbGUgdGV4dCBvciBmaWxlLCBvZnRlbiB1c2VkIGluIEF1dGhlbnRpY2FsIExvZ2luIGFuZCBNYWlsIEF0dGFjaG1lbnQsIGFsc28gc3RvcmVkIGluIHRleHQgZmlsZSBvciBkYXRhYmFzZS4gTW9zdCBTTVRQIHNlcnZlciB3aWxsIGhhbmRsZSB0aGUgbG9naW4gVXNlck5hbWUgYW5kIFBhc3N3b3JkIGluIHRoaXMgd2F5Lg==";
+    
+    	// create a Base64OutputStream 
+    	StringWriter strwriter = new StringWriter(); 
+    	BufferedWriter buffwriter = new BufferedWriter(strwriter);
+    	Base64OutputStream b64_out = new Base64OutputStream(buffwriter);
+    	
+    	byte[] b = str.getBytes();
+    
+		// write the bytes in different lengths to test whether leftover
+		// data is persisted across calls to write
+	    b64_out.write(b, 0, 33);
+	    b64_out.write(b, 33, 1);
+	    b64_out.write(b, 34, 1);
+	    b64_out.write(b, 35, 2);
+	    b64_out.write(b, 37, 3);
+	    b64_out.write(b, 40, 3);
+	    b64_out.write(b, 43, 3);
+	    b64_out.write(b, 46, 5);
+	    b64_out.write(b, 51, 4);
+	    b64_out.write(b, 55, 5);
+	    b64_out.write(b, 60, 6);
+	    b64_out.write(b, 66, 10);
+	    b64_out.write(b, 76, 51);
+	    b64_out.write(b, 127, 150);
+	    b64_out.write(b, 277, 22);
+	    b64_out.write(b, 299, 21);
+	    b64_out.write(b, 320, 2);
+	    	    
+    	// remember to add padding characters (if necessary)
+    	b64_out.finish();
+    	  	
+    	buffwriter.flush();
+		
+    	// compare the contents of the outputstream with the expected encoded string
+		assertEquals(strwriter.toString(), str_encoded);	
+ 	}	
+ 	
+ 	
+  /**
+   * Testing writing binary data whose byte values range from -128 to 128.
+   * We create such data by GZIP-ing the string before writing out to the Base64OutputStream.
+   * 
+   */ 	 	
+  	public void testWriteBinaryData() throws IOException
+ 	{
+ 	  String str = "Base64 Encoding is a popular way to convert the 8bit and the binary to the 7bit for network trans using Socket, and a security method to handle text or file, often used in Authentical Login and Mail Attachment, also stored in text file or database. Most SMTP server will handle the login UserName and Password in this way.";
+	  String str_encoded = "H4sIAAAAAAAAAD2QQW7DMAwEv7IPCHIK2l4ToLe6CJD2AbREx0JkMpDouvl9KQXokVxylssTVX454F2CxiRXpArCXe9rpoKNHjBFUPnhYrCZ8TYmA0nsxZiESh9p1WuTJi0Qtk3LDVZIKtbauBcNN7ZdXyVUDmtJ9sDCNmtshNmVzDD+NThjSpl30MlYnMARSXBc3UYsBcr40Kt3Gm2glHE0ozAvrrpFropqWp5bndhwDRvJaPTIewxaDZfh6+zHFI+HLeX8f4XHyd3h29VPWrhbnalWT/bEzv4qf9D+DzA2UNlCAQAA";
+ 	  
+ 	  byte[] bytes = str.getBytes();
+ 	  
+ 	  StringWriter strwriter = new StringWriter(); 
+      BufferedWriter buffwriter = new BufferedWriter(strwriter);
+      Base64OutputStream b64_out = new Base64OutputStream(buffwriter);
+
+      GZIPOutputStream zip = new GZIPOutputStream(b64_out);
+      
+      zip.write(bytes, 0, bytes.length);
+      zip.finish();
+      buffwriter.flush();
+      b64_out.finish();
+      
+      assertEquals(str_encoded, strwriter.toString());
+	 	
+ 	}
+    
+	 	
+ ////////// private	methods ////////////
+ 	
+	/**
+	 *
+	 *	Writes each individual char from str to a Base64OutputStream and compares
+	 *	the resulting output stream contents with the expected encoded string.  
+	 *
+	 *	@param	str			the decoded string
+	 *	@param	str_encoded	the encoded string
+	 *
+	 **/ 	
+ 	
+	private void _testWriteChar(String str, String str_encoded) throws IOException
+	{
+		// create a Base64OutputStream 
+    	StringWriter strwriter = new StringWriter(); 
+    	BufferedWriter buffwriter = new BufferedWriter(strwriter);
+    	Base64OutputStream b64_out = new Base64OutputStream(buffwriter);
+    
+    	// write out each char in str to the stream
+    	for (int i = 0; i<str.length(); i++) 
+    	{
+     	 b64_out.write((int)str.charAt(i));
+    	}
+    	// remember to add padding characters (if necessary)
+    	b64_out.finish();
+    	
+    	
+    	buffwriter.flush();
+		
+    	// compare the contents of the outputstream with the expected encoded string
+		assertEquals(strwriter.toString(), str_encoded);	
+	}
+ 	
+	/**
+	 *
+	 *	Writes str (after converting to an array of bytes) to a Base64OutputStream 
+	 *	and compares the resulting output stream contents with the expected encoded 
+	 *	string.  
+	 *
+	 *	@param	str			the decoded string
+	 *	@param	str_encoded	the encoded string
+	 *
+	 **/ 	
+	private void _testWriteArray(String str, String str_encoded) throws IOException
+	{	
+		// create a Base64OutputStream 
+    	StringWriter strwriter = new StringWriter(); 
+    	BufferedWriter buffwriter = new BufferedWriter(strwriter);
+    	Base64OutputStream b64_out = new Base64OutputStream(buffwriter);
+  
+    	// convert str into an array of bytes
+    	byte[] b = str.getBytes();
+    	
+    	// write out the array to the output stream
+    	b64_out.write(b, 0, b.length);
+    	// append padding chars if necessary
+    	b64_out.finish();
+    
+    	buffwriter.flush();
+    	
+// 		System.out.println("testwriteArray,  expected encoding:" + str_encoded);    
+//       	System.out.println("testwriteArray, output of encoding:" + strwriter.toString());
+ 
+    	// compare the contents of the outputstream with the expected encoded string
+    	assertEquals(strwriter.toString(), str_encoded);
+	}
+
+  
+  
+  
+} // end Base64OutputStreamTest class

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/test/java/org/apache/myfaces/adf/util/Base64OutputStreamTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message