Author: nbelaevski
Date: 2009-07-12 18:54:01 -0400 (Sun, 12 Jul 2009)
New Revision: 14903
Removed:
framework/trunk/legacy-tests/src/test/java/DnDScriptTest.java
framework/trunk/legacy-tests/src/test/java/org/ajax4jsf/codec/CodecTest.java
framework/trunk/legacy-tests/src/test/java/org/ajax4jsf/codec/CodecTestSuite.java
framework/trunk/legacy-tests/src/test/java/org/ajax4jsf/webapp/AllTests.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/component/UIRangedNumberInputTest.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/component/nsutils/NSUtilsTest.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/component/util/
framework/trunk/legacy-tests/src/test/java/org/richfaces/json/
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/FilterFieldTest.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/ListSequenceDataModelTest.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/ModifiableModelTest.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/SortField2Test.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/StackingTreeDataModelTest.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/Directory.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/File.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/Named.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/Project.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/ObjectWrapperFactoryTest.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/SimplePropertyExpressionTest.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/ValueBindingExpressionTest.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/WrappedBeanFilterTest.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/CompositeRendererTest.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/InputRendererBaseTest.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/TemplateEncoderRendererBaseTest.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/TemplateUtilTest.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/Bean.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/SkinTestCase.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/SkinTests.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/SkinThreadsTestCase.java
framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/TestApplicationFactory.java
framework/trunk/legacy-tests/src/test/resources/META-INF/skins/
framework/trunk/legacy-tests/src/test/resources/org/richfaces/renderkit/
Log:
Framework unit tests updated
Deleted: framework/trunk/legacy-tests/src/test/java/DnDScriptTest.java
===================================================================
--- framework/trunk/legacy-tests/src/test/java/DnDScriptTest.java 2009-07-12 22:53:07 UTC
(rev 14902)
+++ framework/trunk/legacy-tests/src/test/java/DnDScriptTest.java 2009-07-12 22:54:01 UTC
(rev 14903)
@@ -1,74 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-import java.io.IOException;
-
-import org.ajax4jsf.javascript.DnDScript;
-import org.ajax4jsf.resource.FacesResourceContext;
-import org.ajax4jsf.resource.ResourceContext;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-/**
- *
- */
-
-/**
- * @author shura
- *
- */
-public class DnDScriptTest extends AbstractAjax4JsfTestCase {
-
- /**
- * @param name
- */
- public DnDScriptTest(String name) {
- super(name);
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
- */
- public void setUp() throws Exception {
- super.setUp();
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
- */
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
- /**
- * Test method for {@link
org.ajax4jsf.resource.InternetResourceBase#send(org.ajax4jsf.resource.ResourceContext)}.
- */
- public void testSend() {
- DnDScript resource = new DnDScript();
- ResourceContext context = new FacesResourceContext(facesContext);
- try {
- resource.send(context);
- } catch (IOException e) {
- e.printStackTrace();
- assertTrue("error send style",false);
- }
- }
-
-}
Deleted: framework/trunk/legacy-tests/src/test/java/org/ajax4jsf/codec/CodecTest.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/ajax4jsf/codec/CodecTest.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/ajax4jsf/codec/CodecTest.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,88 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.codec;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.tests.AbstractThreadedAjax4JsfTestCase;
-import org.ajax4jsf.util.base64.Codec;
-
-public class CodecTest extends AbstractThreadedAjax4JsfTestCase {
- Codec c;
-
- public CodecTest(String s) {
- super(s);
- }
-
- public void setUp() throws Exception {
- super.setUp();
- String message = "";
- try {
- c = new Codec("anbshsquycwuudyft");
- } catch (Exception e) {
- message = "Cannot create Codec instance " + e.getMessage();
- }
- assertNotNull(message, c);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
- public void testCodec() {
- CodecTestRunnable[] runnables = new CodecTestRunnable[100];
- for (int i = 0; i < runnables.length; i++) {
- runnables[i] = new CodecTestRunnable(c, generateRandomString(), i);
- }
- runTestCaseRunnables(runnables);
- }
-
- private String generateRandomString() {
- StringBuffer ss = new StringBuffer();
- for (int i = 0; i < 50000; i++) {
- char c = (char)(96 + Math.random() * 26);
- ss.append(c);
- }
- return ss.toString();
- }
-
- class CodecTestRunnable extends TestCaseRunnable {
- Codec c;
- String s;
- int id;
-
- public CodecTestRunnable(Codec c, String s, int id) {
- this.c = c;
- this.s = s;
- this.id = id;
- }
-
-
- public void runTestCase(FacesContext context) throws Throwable {
- String s1 = c.encode(s);
- String s2 = c.decode(s1);
- assertEquals("Failure in thread " + id, s2, s);
- }
-
- }
-
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/ajax4jsf/codec/CodecTestSuite.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/ajax4jsf/codec/CodecTestSuite.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/ajax4jsf/codec/CodecTestSuite.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,36 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.codec;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class CodecTestSuite {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(
- "Test for org.ajax4jsf.codec");
- suite.addTestSuite(CodecTest.class);
- return suite;
- }
-
-}
Deleted: framework/trunk/legacy-tests/src/test/java/org/ajax4jsf/webapp/AllTests.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/ajax4jsf/webapp/AllTests.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/ajax4jsf/webapp/AllTests.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,38 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.webapp;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class AllTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(
- "Test for org.ajax4jsf.webapp");
- //$JUnit-BEGIN$
- suite.addTestSuite(WebXmlTest.class);
- //$JUnit-END$
- return suite;
- }
-
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/component/UIRangedNumberInputTest.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/component/UIRangedNumberInputTest.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/component/UIRangedNumberInputTest.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,127 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-public class UIRangedNumberInputTest extends AbstractAjax4JsfTestCase {
-
- private UIRangedNumberInput input;
-
- public UIRangedNumberInputTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- input = new UIRangedNumberInput() {
- private String minValue;
- private String maxValue;
- private boolean disabled;
-
- public String getMinValue() {
- return minValue;
- }
- public void setMinValue(String minValue) {
- this.minValue = minValue;
- }
- public String getMaxValue() {
- return maxValue;
- }
- public void setMaxValue(String maxValue) {
- this.maxValue = maxValue;
- }
- public boolean isDisabled() {
- return disabled;
- }
- public void setDisabled(boolean disabled) {
- this.disabled = disabled;
- }
- };
-
- input.setMaxValue("100");
- input.setMinValue("0");
- input.setValid(true);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- this.input = null;
- }
-
- private void checkValid() {
- assertTrue(input.isValid());
- assertFalse(facesContext.getMessages().hasNext());
- }
-
- private void checkInvalid() {
- assertFalse(input.isValid());
- assertTrue(facesContext.getMessages().hasNext());
- }
-
- public void testValidateValueFacesContextObject() {
- checkValid();
- input.validateValue(facesContext, new Double(23.45));
- checkValid();
- }
-
- public void testValidateNullValue() throws Exception {
- checkValid();
- input.validateValue(facesContext, null);
- checkValid();
- }
-
- public void testValidateMinValue() throws Exception {
- checkValid();
- input.validateValue(facesContext, new Double(-23.45));
- checkInvalid();
- }
-
- public void testValidateMaxValue() throws Exception {
- checkValid();
- input.validateValue(facesContext, new Double(223.45));
- checkInvalid();
- }
-
-
- public void testValidateMinNullMinValue() throws Exception {
- input.setMinValue(null);
- checkValid();
- input.validateValue(facesContext, new Double(-23.45));
- checkInvalid();
- }
-
- public void testValidateMaxNullMaxValue() throws Exception {
- input.setMaxValue(null);
- checkValid();
- input.validateValue(facesContext, new Double(223.45));
- checkInvalid();
- }
-
- public void testValidateIllegalValue() throws Exception {
- checkValid();
- input.validateValue(facesContext, "string");
- checkInvalid();
- }
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/component/nsutils/NSUtilsTest.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/component/nsutils/NSUtilsTest.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/component/nsutils/NSUtilsTest.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,64 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component.nsutils;
-
-import java.io.StringWriter;
-
-import javax.faces.component.UIInput;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.apache.shale.test.mock.MockResponseWriter;
-
-public class NSUtilsTest extends AbstractAjax4JsfTestCase {
-
- public NSUtilsTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
- public void testWriteNameSpace() throws Exception {
- StringWriter stringWriter = new StringWriter();
- facesContext.setResponseWriter(new MockResponseWriter(stringWriter,
"text/html", "UTF8"));
- ResponseWriter writer = facesContext.getResponseWriter();
-
- UIInput input = new UIInput();
-
- writer.startDocument();
- writer.startElement("span", input);
-
- NSUtils.writeNameSpace(facesContext, input);
-
- writer.endElement("span");
- writer.endDocument();
-
- String result = stringWriter.getBuffer().toString();
- assertTrue(result.contains("span
xmlns:rich=\"http://richfaces.ajax4jsf.org/rich\""));
- }
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/FilterFieldTest.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/FilterFieldTest.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/FilterFieldTest.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,87 +0,0 @@
-/**
- *
- */
-package org.richfaces.model;
-
-import javax.el.ValueExpression;
-
-import org.ajax4jsf.tests.MockValueExpression;
-
-import junit.framework.TestCase;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public class FilterFieldTest extends TestCase {
-
- private Field field;
- private ValueExpression expression;
-
- /**
- * @param name
- */
- public FilterFieldTest(String name) {
- super(name);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- expression = new MockValueExpression(null);
- field = new FilterField(expression);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- field = null;
- expression = null;
- super.tearDown();
- }
-
- /**
- * Test method for {@link
org.richfaces.model.FilterField#FilterField(javax.el.ValueExpression)}.
- */
- public final void testFilterField() {
- Field filterField = new FilterField(expression);
- assertEquals(filterField, field);
- }
-
- /**
- * Test method for {@link org.richfaces.model.Field#hashCode()}.
- */
- public final void testHashCode() {
- Field filterField = new FilterField(expression);
- assertEquals(filterField.hashCode(), field.hashCode());
- }
-
- /**
- * Test method for {@link org.richfaces.model.Field#equals(java.lang.Object)}.
- */
- public final void testEqualsObject() {
- Field filterField = new FilterField(null);
- assertFalse(filterField.equals(field));
- filterField.setExpression(expression);
- assertTrue(filterField.equals(field));
- }
-
- /**
- * Test method for {@link org.richfaces.model.Field#getExpression()}.
- */
- public final void testGetExpression() {
- assertSame(field.getExpression(), expression);
- }
-
- /**
- * Test method for {@link
org.richfaces.model.Field#setExpression(javax.el.ValueExpression)}.
- */
- public final void testSetExpression() {
- field.setExpression(null);
- assertNull(field.getExpression());
- }
-
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/ListSequenceDataModelTest.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/ListSequenceDataModelTest.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/ListSequenceDataModelTest.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,133 +0,0 @@
-/**
- *
- */
-package org.richfaces.model;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.SequenceRange;
-
-import junit.framework.TestCase;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public class ListSequenceDataModelTest extends TestCase {
-
- private List<Integer> list;
- private ListSequenceDataModel model;
- private ListSequenceDataModel nullModel;
-
- /**
- * @param name
- */
- public ListSequenceDataModelTest(String name) {
- super(name);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- list = new ArrayList<Integer>();
- for (int i = 0; i < 10; i++) {
- list.add(new Integer(i));
- }
- model = new ListSequenceDataModel(list);
- nullModel = new ListSequenceDataModel(null);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- nullModel = null;
- model = null;
- list = null;
- }
-
- /**
- * Test method for {@link org.richfaces.model.ListSequenceDataModel#isRowAvailable()}.
- */
- public final void testIsRowAvailable() {
- assertFalse(nullModel.isRowAvailable());
- assertTrue(model.isRowAvailable());
- model.setRowIndex(-1);
- assertFalse(model.isRowAvailable());
- }
-
- /**
- * Test method for {@link org.richfaces.model.ListSequenceDataModel#getRowCount()}.
- */
- public final void testGetRowCount() {
- assertEquals(model.getRowCount(), list.size());
- assertEquals(nullModel.getRowCount(), -1);
- }
-
- /**
- * Test method for {@link org.richfaces.model.ListSequenceDataModel#setRowIndex()}
- * and {@link org.richfaces.model.ListSequenceDataModel#getRowIndex()}.
- */
- public final void testRowIndex() {
- int i = 3;
- model.setRowIndex(i);
- assertEquals(model.getRowIndex(), i);
- }
-
- /**
- * Test method for {@link
org.richfaces.model.ListSequenceDataModel#setRowKey(java.lang.Object)}
- * and {@link org.richfaces.model.ListSequenceDataModel#getRowKey(java.lang.Object)}.
- */
- public final void testRowKey() {
- Integer i = 3;
- model.setRowKey(i);
- assertEquals(model.getRowKey(), i);
- model.setRowKey(null);
- assertNull(model.getRowKey());
- }
-
- /**
- * Test method for {@link
org.richfaces.model.ListSequenceDataModel#walk(javax.faces.context.FacesContext,
org.ajax4jsf.model.DataVisitor, org.ajax4jsf.model.Range, java.lang.Object)}
- * and {@link org.richfaces.model.ListSequenceDataModel#getRowData()}.
- */
- public final void testWalk() {
- DataVisitor visitor = new DataVisitor(){
- public void process(FacesContext context, Object rowKey,
- Object argument) throws IOException {
- Object key = model.getRowKey();
- model.setRowKey(rowKey);
- assertEquals(model.getRowData(), list.get(((Integer)rowKey).intValue()));
- model.setRowKey(key);
- }
- };
- try {
- SequenceRange range = new SequenceRange(0, -1);
- model.walk(null, visitor, range, null);
- range = new SequenceRange(0, 5);
- model.walk(null, visitor, range, null);
- } catch (IOException e) {
- fail(e.getMessage());
- }
- }
-
- /**
- * Test method for {@link
org.richfaces.model.ListSequenceDataModel#ListSequenceDataModel(java.util.List)},
- * {@link org.richfaces.model.ListSequenceDataModel#setWrappedData(java.lang.Object)}
- * and {@link org.richfaces.model.ListSequenceDataModel#getWrappedData()} .
- */
- public final void testListSequenceDataModel() {
- assertNull(nullModel.getWrappedData());
- ListSequenceDataModel dataModel = new ListSequenceDataModel(list);
- assertSame(dataModel.getWrappedData(), model.getWrappedData());
-
- }
-
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/ModifiableModelTest.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/ModifiableModelTest.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/ModifiableModelTest.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,201 +0,0 @@
-/**
- *
- */
-package org.richfaces.model;
-
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.el.ValueExpression;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.ExtendedDataModel;
-import org.ajax4jsf.model.SequenceRange;
-import org.ajax4jsf.tests.MockDataModel;
-import org.ajax4jsf.tests.MockDataModelListener;
-import org.ajax4jsf.tests.MockValueExpression;
-import org.apache.shale.test.base.AbstractJsfTestCase;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public class ModifiableModelTest extends AbstractJsfTestCase {
-
- private ModifiableModel model;
- private ExtendedDataModel originalModel;
- private String var;
- private List<FilterField> filterFields;
- private List<SortField2> sortFields;
-
- /**
- * @param name
- */
- public ModifiableModelTest(String name) {
- super(name);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- public void setUp() throws Exception {
- super.setUp();
- var = "var";
- originalModel = new MockDataModel();
- filterFields = new LinkedList<FilterField>();
- sortFields = new LinkedList<SortField2>();
- model = new ModifiableModel(originalModel, var);
- model.modify(filterFields, sortFields);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- public void tearDown() throws Exception {
- model = null;
- var = null;
- filterFields = null;
- sortFields = null;
- originalModel = null;
- super.tearDown();
- }
-
- /**
- * Test method for {@link org.richfaces.model.ModifiableModel#isRowAvailable()}.
- */
- public final void testIsRowAvailable() {
- assertEquals(model.isRowAvailable(), originalModel.isRowAvailable());
- }
-
- /**
- * Test method for {@link org.richfaces.model.ModifiableModel#getRowCount()}.
- */
- public final void testGetRowCount() {
- assertEquals(model.getRowCount(), originalModel.getRowCount());
- }
-
- /**
- * Test method for {@link org.richfaces.model.ModifiableModel#getRowIndex()}.
- */
- public final void testGetRowIndex() {
- assertEquals(model.getRowIndex(), originalModel.getRowIndex());
- }
-
- /**
- * Test method for {@link org.richfaces.model.ModifiableModel#setRowIndex(int)}.
- */
- public final void testSetRowIndex() {
- model.setRowIndex(5);
- assertEquals(model.getRowIndex(), originalModel.getRowIndex());
- }
-
- /**
- * Test method for {@link
org.richfaces.model.ModifiableModel#setRowKey(java.lang.Object)}.
- */
- public final void testSetRowKey() {
- model.setRowKey(new Integer(5));
- assertEquals(model.getRowKey(), originalModel.getRowKey());
- }
-
- /**
- * Test method for {@link org.richfaces.model.ModifiableModel#getRowKey()}.
- */
- public final void testGetRowKey() {
- assertEquals(model.getRowKey(), originalModel.getRowKey());
- }
-
- /**
- * Test method for {@link
org.richfaces.model.ModifiableModel#getSerializableModel(org.ajax4jsf.model.Range)}.
- */
- public final void testGetSerializableModel() {
- assertEquals(model.getSerializableModel(null),
originalModel.getSerializableModel(null));
- }
-
- /**
- * Test method for {@link
org.richfaces.model.ModifiableModel#walk(javax.faces.context.FacesContext,
org.ajax4jsf.model.DataVisitor, org.ajax4jsf.model.Range, java.lang.Object)}.
- */
- public final void testWalk() {
- SequenceRange range = new SequenceRange(0, -1);
- DataVisitor visitor = new DataVisitor(){
- public void process(FacesContext context, Object rowKey,
- Object argument) throws IOException {
- Object key = model.getRowKey();
- model.setRowKey(rowKey);
- Object key2 = originalModel.getRowKey();
- originalModel.setRowKey(rowKey);
- assertEquals(model.getRowData(), originalModel.getRowData());
- model.setRowKey(key);
- originalModel.setRowKey(key2);
- }
- };
- try {
- model.walk(null, visitor, range, null);
- ValueExpression expression = new MockValueExpression(Boolean.TRUE);
- filterFields.add(new FilterField(expression));
- sortFields.add(new SortField2(expression, Ordering.ASCENDING));
- model.walk(null, visitor, range, null);
- } catch (IOException e) {
- fail(e.getMessage());
- }
- }
-
- /**
- * Test method for {@link
org.richfaces.model.ModifiableModel#ModifiableModel(org.ajax4jsf.model.ExtendedDataModel,
java.lang.String, java.util.List, java.util.List)}.
- */
- public final void testModifiableModel() {
- ModifiableModel modifiableModel = new ModifiableModel(originalModel, var);;
- assertNotNull(modifiableModel);
- }
-
- /**
- * Test method for {@link
org.richfaces.model.ModifiableModel#addDataModelListener(javax.faces.model.DataModelListener)}.
- */
- public final void testAddDataModelListenerDataModelListener() {
- MockDataModelListener listener = new MockDataModelListener();
- model.addDataModelListener(listener);
- assertEquals(model.getDataModelListeners()[0], listener);
- }
-
- /**
- * Test method for {@link org.richfaces.model.ModifiableModel#getDataModelListeners()}.
- */
- public final void testGetDataModelListeners() {
- assertEquals(model.getDataModelListeners().length, 0);
- }
-
- /**
- * Test method for {@link org.richfaces.model.ModifiableModel#getRowData()}.
- */
- public final void testGetRowData() {
- assertEquals(model.getRowData(), originalModel.getRowData());
- }
-
- /**
- * Test method for {@link org.richfaces.model.ModifiableModel#getWrappedData()}.
- */
- public final void testGetWrappedData() {
- assertEquals(model.getWrappedData(), originalModel.getWrappedData());
- }
-
- /**
- * Test method for {@link
org.richfaces.model.ModifiableModel#removeDataModelListener(javax.faces.model.DataModelListener)}.
- */
- public final void testRemoveDataModelListenerDataModelListener() {
- MockDataModelListener listener = new MockDataModelListener();
- model.addDataModelListener(listener);
- assertEquals(model.getDataModelListeners()[0], listener);
- model.removeDataModelListener(listener);
- assertEquals(model.getDataModelListeners().length, 0);
- }
-
- /**
- * Test method for {@link
org.richfaces.model.ModifiableModel#setWrappedData(java.lang.Object)}.
- */
- public final void testSetWrappedDataObject() {
- model.setWrappedData(var);
- assertEquals(originalModel.getWrappedData(), var);
- }
-
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/SortField2Test.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/SortField2Test.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/SortField2Test.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,99 +0,0 @@
-/**
- *
- */
-package org.richfaces.model;
-
-import javax.el.ValueExpression;
-
-import org.ajax4jsf.tests.MockValueExpression;
-
-import junit.framework.TestCase;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public class SortField2Test extends TestCase {
-
- private SortField2 field;
- private ValueExpression expression;
- private Ordering ordering;
- /**
- * @param name
- */
- public SortField2Test(String name) {
- super(name);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- expression = new MockValueExpression(null);
- ordering = Ordering.ASCENDING;
- field = new SortField2(expression, ordering);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- field = null;
- ordering = null;
- expression = null;
- super.tearDown();
- }
-
- /**
- * Test method for {@link org.richfaces.model.SortField2#hashCode()}.
- */
- public final void testHashCode() {
- Field sortField = new SortField2(expression, ordering);
- assertEquals(sortField.hashCode(), field.hashCode());
- }
-
- /**
- * Test method for {@link org.richfaces.model.SortField2#equals(java.lang.Object)}.
- */
- public final void testEqualsObject() {
- SortField2 sortField = new SortField2(null);
- assertFalse(sortField.equals(field));
- sortField.setExpression(expression);
- sortField.setOrdering(ordering);
- assertTrue(sortField.equals(field));
- }
-
- /**
- * Test method for {@link
org.richfaces.model.SortField2#SortField2(javax.el.ValueExpression)}.
- */
- public final void testSortField2ValueExpression() {
- SortField2 sortField2 = new SortField2(expression);
- field.setOrdering(null);
- assertEquals(sortField2, field);
- }
-
- /**
- * Test method for {@link
org.richfaces.model.SortField2#SortField2(javax.el.ValueExpression,
org.richfaces.model.Ordering)}.
- */
- public final void testSortField2ValueExpressionOrdering() {
- SortField2 sortField2 = new SortField2(expression, ordering);
- assertEquals(sortField2, field);
- }
-
- /**
- * Test method for {@link org.richfaces.model.SortField2#getOrdering()}.
- */
- public final void testGetOrdering() {
- assertEquals(field.getOrdering(), ordering);
- }
-
- /**
- * Test method for {@link
org.richfaces.model.SortField2#setOrdering(org.richfaces.model.Ordering)}.
- */
- public final void testSetOrdering() {
- field.setOrdering(null);
- assertNull(field.getOrdering());
- }
-
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/StackingTreeDataModelTest.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/StackingTreeDataModelTest.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/StackingTreeDataModelTest.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,454 +0,0 @@
-/**
- *
- */
-package org.richfaces.model;
-
-import java.io.IOException;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.richfaces.model.StackingTreeModel.Key;
-import org.richfaces.model.entity.Directory;
-import org.richfaces.model.entity.File;
-import org.richfaces.model.entity.Named;
-import org.richfaces.model.entity.Project;
-
-
-/**
- * @author Nick Belaevski
- * mailto:nbelaevski@exadel.com
- * created 30.07.2007
- *
- */
-public class StackingTreeDataModelTest extends AbstractAjax4JsfTestCase {
-
- public StackingTreeDataModelTest(String name) {
- super(name);
- }
-
- private StackingTreeModel stackingTreeModel;
- private StackingTreeModel projectsModel;
- private StackingTreeModel directoriesModel;
- private StackingTreeModel filesModel;
-
- private Object projectRequestObject;
- private Object directoryRequestObject;
- private Object fileRequestObject;
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
- */
- public void setUp() throws Exception {
- super.setUp();
- this.stackingTreeModel = new StackingTreeModel();
- projectsModel = new StackingTreeModel("project", "project", new
StackingTreeModelDataProvider() {
-
- private Map data = null;
-
- public Object getData() {
- if (data == null) {
- data = new LinkedHashMap();
- Project projectA = new Project("projectA", 10);
-
- Directory adir1 = new Directory("ADir1", 50);
-
- adir1.addFile(new File("AFile1", 60));
- adir1.addFile(new File("AFile2", 61));
-
- Directory adir2 = new Directory("ADir2", 101);
-
- projectA.addDirectory(adir1);
- projectA.addDirectory(adir2);
-
- data.put(projectA.getName(), projectA);
-
- Project projectB = new Project("projectB", 501);
-
- Directory bdir1 = new Directory("BDir1", 600);
- Directory bdir2 = new Directory("BDir2", 700);
- Directory bdir3 = new Directory("BDir3", 801);
-
- projectB.addDirectory(bdir1);
- projectB.addDirectory(bdir2);
- projectB.addDirectory(bdir3);
-
- data.put(projectB.getName(), projectB);
- }
- return data;
- }
- });
- final ValueBinding dirVB =
application.createValueBinding("#{project.directories}");
- directoriesModel = new StackingTreeModel("directory", "directory",
new StackingTreeModelDataProvider() {
- public Object getData() {
- return dirVB.getValue(facesContext);
- }
- });
- final ValueBinding fileVB =
application.createValueBinding("#{directory.files}");
- filesModel = new StackingTreeModel("file", "file", new
StackingTreeModelDataProvider() {
- public Object getData() {
- return fileVB.getValue(facesContext);
- }
- });
- directoriesModel.addStackingModel(filesModel);
- projectsModel.addStackingModel(directoriesModel);
- this.stackingTreeModel.addStackingModel(projectsModel);
-
- projectRequestObject = new Object();
- directoryRequestObject = new Object();
- fileRequestObject = new Object();
-
- Map requestParameterMap = facesContext.getExternalContext().getRequestParameterMap();
- requestParameterMap.put("project", projectRequestObject);
- requestParameterMap.put("directory", directoryRequestObject);
- requestParameterMap.put("file", fileRequestObject);
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
- */
- public void tearDown() throws Exception {
- super.tearDown();
- this.stackingTreeModel = null;
- this.projectsModel = null;
- this.directoriesModel = null;
- this.filesModel = null;
-
- this.projectRequestObject = null;
- this.directoryRequestObject = null;
- this.fileRequestObject = null;
- }
-
- public void testWalk() throws Exception {
- StackingTreeDataModelTestVisitor1 visitor1 = new StackingTreeDataModelTestVisitor1();
- this.stackingTreeModel.walk(facesContext, visitor1, null, null);
- assertEquals(9, visitor1.getCounter());
- this.stackingTreeModel.setRowKey(null);
- assertFalse(this.stackingTreeModel.isRowAvailable());
-
- Map requestParameterMap = facesContext.getExternalContext().getRequestParameterMap();
- assertSame(this.projectRequestObject, requestParameterMap.get("project"));
- assertSame(this.directoryRequestObject,
requestParameterMap.get("directory"));
- assertSame(this.fileRequestObject, requestParameterMap.get("file"));
- }
-
- public void testBadKey() throws Exception {
- StackingTreeDataModelTestVisitor1 visitor1 = new StackingTreeDataModelTestVisitor1();
- this.stackingTreeModel.walk(facesContext, visitor1, null, null);
- this.stackingTreeModel.setRowKey(new ListRowKey(new
StackingTreeModel.Key("project", "projectA")));
- assertTrue(this.stackingTreeModel.isRowAvailable());
- assertNotNull(this.stackingTreeModel.getRowData());
-
- assertNull(this.stackingTreeModel.getTreeNode());
- assertFalse(this.stackingTreeModel.isLeaf());
-
- this.stackingTreeModel.setRowKey(new ListRowKey(new
StackingTreeModel.Key("project", "projectAAAAA")));
- assertFalse(this.stackingTreeModel.isRowAvailable());
- try {
- Object rowData = this.stackingTreeModel.getRowData();
- assertNull(rowData);
- //FIXME: Maksim - bad keys happen for a reason
- //fail();
- } catch (Exception e) {
-
- }
-
- try {
- boolean leaf = this.stackingTreeModel.isLeaf();
- assertTrue(leaf);
- //FIXME: Maksim - bad keys happen for a reason
- //fail();
- } catch (Exception e) {
-
- }
-
- try {
- TreeNode node = this.stackingTreeModel.getTreeNode();
- assertNull(node);
- //FIXME: Maksim - bad keys happen for a reason
- //fail();
- } catch (Exception e) {
-
- }
- }
-
- public void testActiveData() throws Exception {
- final ValueBinding fileVB =
application.createValueBinding("#{directory.files}");
- StackingTreeModel localFilesModel = new StackingTreeModel("file",
"file", new StackingTreeModelDataProvider() {
- public Object getData() {
- return fileVB.getValue(facesContext);
- }
-
- }) {
- protected boolean isActiveData() {
- Map requestMap = externalContext.getRequestMap();
- Object object = requestMap.get("file");
- assertNotNull(object);
- File file = (File) object;
- if (file.getTag() == 61) {
- return false;
- }
-
- return super.isActiveData();
- }
- };
- directoriesModel.removeStackingModel(filesModel);
- directoriesModel.addStackingModel(localFilesModel);
-
- stackingTreeModel.walk(facesContext, new StackingTreeDataModelTestVisitor3(), null,
null);
- }
-
- public void testKey() throws Exception {
- Key key = new Key("aaa", new Integer(10));
- Key key2 = new Key("aaa", new Integer(11));
- Key key3 = new Key("aaa", new Integer(10));
- Key key4 = new Key("bbb", new Integer(10));
-
- assertFalse(key.equals(new Key("aaa", new Integer(0)) {} ));
-
- assertTrue(key.equals(key3));
- assertTrue(key3.equals(key));
- assertTrue(key2.equals(key2));
- assertTrue(key4.equals(key4));
-
- assertTrue(key.hashCode() == key3.hashCode());
- assertTrue(key3.hashCode() == key.hashCode());
- assertTrue(key2.hashCode() == key2.hashCode());
- assertTrue(key4.hashCode() == key4.hashCode());
-
- assertFalse(key.equals(key2));
- assertFalse(key3.equals(key2));
- assertFalse(key2.equals(key));
- assertFalse(key2.equals(key3));
-
- assertFalse(key.hashCode() == key2.hashCode());
- assertFalse(key3.hashCode() == key2.hashCode());
- assertFalse(key2.hashCode() == key.hashCode());
- assertFalse(key2.hashCode() == key3.hashCode());
-
- assertFalse(key4.equals(key));
- assertFalse(key4.equals(key2));
- assertFalse(key4.equals(key3));
-
- assertFalse(key4.hashCode() == key.hashCode());
- assertFalse(key4.hashCode() == key2.hashCode());
- assertFalse(key4.hashCode() == key3.hashCode());
-
- assertFalse(key.equals(key4));
- assertFalse(key2.equals(key4));
- assertFalse(key3.equals(key4));
-
- assertFalse(new Key("aaa", new Integer(10)).equals(null));
- assertFalse(new Key("aaa", null).equals(null));
- assertFalse(new Key(null, new Integer(10)).equals(null));
- assertFalse(new Key(null, null).equals(null));
-
- assertFalse(key.hashCode() == key4.hashCode());
- assertFalse(key2.hashCode() == key4.hashCode());
- assertFalse(key3.hashCode() == key4.hashCode());
-
- assertFalse(key.hashCode() == 0);
- assertFalse(key2.hashCode() == 0);
- assertFalse(key3.hashCode() == 0);
- assertFalse(key4.hashCode() == 0);
-
- assertTrue(new Key(null, new Integer(11)).equals(new Key(null, new Integer(11))));
- assertFalse(new Key(null, new Integer(10)).equals(new Key(null, new Integer(11))));
- assertFalse(new Key(null, new Integer(10)).equals(new Key("aaa", new
Integer(10))));
-
- assertTrue(new Key(null, new Integer(11)).hashCode() == new Key(null, new
Integer(11)).hashCode());
- assertFalse(new Key(null, new Integer(10)).hashCode() == new Key(null, new
Integer(11)).hashCode());
- assertFalse(new Key(null, new Integer(10)).hashCode() == new Key("aaa", new
Integer(10)).hashCode());
-
- assertTrue(new Key("aaa", null).equals(new Key("aaa", null)));
- assertFalse(new Key("aaa", null).equals(new Key("bbb", null)));
- assertFalse(new Key("aaa", null).equals(new Key("aaa", new
Integer(10))));
-
- assertTrue(new Key("aaa", null).hashCode() == new Key("aaa",
null).hashCode());
- assertFalse(new Key("aaa", null).hashCode() == new Key("bbb",
null).hashCode());
- assertFalse(new Key("aaa", null).hashCode() == new Key("aaa", new
Integer(10)).hashCode());
- }
-
- class StackingTreeDataModelTestVisitor1 implements DataVisitor, LastElementAware {
-
- private boolean last;
- private int tag = 0;
- private int counter = 0;
-
- public void process(FacesContext context, Object rowKey, Object argument)
- throws IOException {
-
- StackingTreeDataModelTestVisitor2 visitor2 = new StackingTreeDataModelTestVisitor2();
-
- stackingTreeModel.walk(context, visitor2, null, new ListRowKey(new
StackingTreeModel.Key("project", "projectA")),
- argument, false);
-
- assertEquals(5, visitor2.getCounter());
-
- StackingTreeDataModelTestVisitor2 visitor20 = new
StackingTreeDataModelTestVisitor2();
-
- stackingTreeModel.walk(context, visitor20, new TreeRange() {
-
- public boolean processChildren(TreeRowKey rowKey) {
- return false;
- }
-
- public boolean processNode(TreeRowKey rowKey) {
- return false;
- }
-
- }, new ListRowKey(new StackingTreeModel.Key("project",
"projectA")),
- argument, false);
-
- assertEquals(0, visitor20.getCounter());
-
- StackingTreeDataModelTestVisitor2 visitor21 = new
StackingTreeDataModelTestVisitor2();
-
- stackingTreeModel.walk(context, visitor21, new TreeRange() {
-
- public boolean processChildren(TreeRowKey rowKey) {
- return false;
- }
-
- public boolean processNode(TreeRowKey rowKey) {
- return true;
- }
-
- }, new ListRowKey(new StackingTreeModel.Key("project",
"projectA")),
- argument, false);
-
- assertEquals(1, visitor21.getCounter());
-
- StackingTreeDataModelTestVisitor2 visitor22 = new
StackingTreeDataModelTestVisitor2();
-
- stackingTreeModel.walk(context, visitor22, null, new ListRowKey(new
StackingTreeModel.Key("project", "projectB")),
- argument, false);
-
- assertEquals(4, visitor22.getCounter());
-
- StackingTreeDataModelTestVisitor2 visitor23 = new
StackingTreeDataModelTestVisitor2();
-
- stackingTreeModel.walk(context, visitor23, new TreeRange() {
-
- private boolean rootProcessed = false;
-
- public boolean processChildren(TreeRowKey rowKey) {
- boolean result = rootProcessed;
- rootProcessed = true;
- return !result;
- }
-
- public boolean processNode(TreeRowKey rowKey) {
- return true;
- }
-
- }, new ListRowKey(new StackingTreeModel.Key("project",
"projectB")),
- argument, false);
-
- assertEquals(4, visitor23.getCounter());
-
- stackingTreeModel.setRowKey(rowKey);
-
- assertSame(rowKey, stackingTreeModel.getRowKey());
-
- assertNull(stackingTreeModel.getTreeNode());
- Object rowData = stackingTreeModel.getRowData();
- assertNotNull(rowData);
- assertTrue(rowData instanceof Named);
-
- Named named = (Named) rowData;
-
- int currentTag = named.getTag();
- assertTrue(currentTag > tag);
- this.tag = currentTag;
-
- if (this.tag % 10 == 1) {
- assertTrue(last);
- } else {
- assertFalse(last);
- }
-
- if (named instanceof Directory) {
- if ("ADir1".equals(named.getName())) {
- assertFalse(stackingTreeModel.isLeaf());
- } else {
- assertTrue(stackingTreeModel.isLeaf());
- }
- } else if (named instanceof Project) {
- assertFalse(stackingTreeModel.isLeaf());
- } else if (named instanceof File) {
- assertTrue(stackingTreeModel.isLeaf());
- } else {
- fail();
- }
-
- counter++;
- }
-
- public void resetLastElement() {
- this.last = false;
- }
-
- public void setLastElement() {
- this.last = true;
- }
-
- public int getCounter() {
- return counter;
- }
- }
-
- class StackingTreeDataModelTestVisitor2 implements DataVisitor {
- private int counter = 0;
- private int tag = 0;
-
- public void process(FacesContext context, Object rowKey, Object argument)
- throws IOException {
-
- stackingTreeModel.setRowKey(rowKey);
- Object rowData = stackingTreeModel.getRowData();
- assertNotNull(rowData);
- Named named = (Named) rowData;
-
- int currentTag = named.getTag();
- assertTrue(currentTag > tag);
- tag = currentTag;
- counter++;
- }
-
- public int getCounter() {
- return counter;
- }
- }
-
- class StackingTreeDataModelTestVisitor3 implements DataVisitor, LastElementAware {
-
- private boolean last;
-
- public void process(FacesContext context, Object rowKey, Object argument)
- throws IOException {
-
- stackingTreeModel.setRowKey(rowKey);
- Named named = (Named) stackingTreeModel.getRowData();
- int tag = named.getTag();
-
- if (tag == 60) {
- assertTrue(last);
- }
- assertFalse(tag == 61);
- }
-
- public void resetLastElement() {
- this.last = false;
- }
-
- public void setLastElement() {
- this.last = true;
- }
- }
-}
-
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/Directory.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/Directory.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/Directory.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,30 +0,0 @@
-/**
- *
- */
-package org.richfaces.model.entity;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Nick Belaevski
- * mailto:nbelaevski@exadel.com
- * created 30.07.2007
- *
- */
-public class Directory extends Named {
-
- public Directory(String name, int tag) {
- super(name, tag);
- }
-
- private List files = new ArrayList();
-
- public List getFiles() {
- return files;
- }
-
- public void addFile(File file) {
- this.files.add(file);
- }
-}
Deleted: framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/File.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/File.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/File.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,18 +0,0 @@
-/**
- *
- */
-package org.richfaces.model.entity;
-
-/**
- * @author Nick Belaevski
- * mailto:nbelaevski@exadel.com
- * created 30.07.2007
- *
- */
-public class File extends Named {
-
- public File(String name, int tag) {
- super(name, tag);
- }
-
-}
Deleted: framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/Named.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/Named.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/Named.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,27 +0,0 @@
-/**
- *
- */
-package org.richfaces.model.entity;
-
-/**
- * @author Nick Belaevski
- * mailto:nbelaevski@exadel.com
- * created 30.07.2007
- *
- */
-public class Named {
- private String name;
- private int tag;
- public String getName() {
- return name;
- }
- public int getTag() {
- return tag;
- }
- public Named(String name, int tag) {
- super();
- this.name = name;
- this.tag = tag;
- }
-
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/Project.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/Project.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/Project.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,29 +0,0 @@
-/**
- *
- */
-package org.richfaces.model.entity;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Nick Belaevski
- * mailto:nbelaevski@exadel.com
- * created 30.07.2007
- *
- */
-public class Project extends Named {
- public Project(String name, int tag) {
- super(name, tag);
- }
-
- private List directories = new ArrayList();
-
- public List getDirectories() {
- return directories;
- }
-
- public void addDirectory(Directory directory) {
- directories.add(directory);
- }
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/ObjectWrapperFactoryTest.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/ObjectWrapperFactoryTest.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/ObjectWrapperFactoryTest.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,200 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.model.impl.expressive;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Random;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.richfaces.model.SortField;
-import org.richfaces.model.SortOrder;
-import org.richfaces.model.impl.expressive.JavaBeanWrapper;
-import org.richfaces.model.impl.expressive.ObjectWrapperFactory;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public class ObjectWrapperFactoryTest extends AbstractAjax4JsfTestCase {
-
-
- /**
- *
- */
- SortField [] sortFields;
- SortOrder sortOrder;
- private ObjectWrapperFactory factory;
- private String var = "abc";
-
- public ObjectWrapperFactoryTest(String name) {
- super(name);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- public void setUp() throws Exception {
- super.setUp();
- sortFields = new SortField[3];
- sortFields[0] = new SortField("_id1", Boolean.TRUE);
- sortFields[1] = new SortField("name", Boolean.FALSE);
- sortFields[2] = new SortField("#{" +var + ".name}", Boolean.TRUE);
- sortOrder = new SortOrder(sortFields);
-
- factory = new ObjectWrapperFactory(facesContext, var, sortOrder);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- public void tearDown() throws Exception {
- super.tearDown();
-
- sortFields = null;
- sortOrder = null;
- factory = null;
- }
-
- /**
- * Test method for {@link
org.richfaces.model.impl.expressive.ObjectWrapperFactory#convertList(java.util.List,
org.richfaces.model.impl.expressive.ObjectWrapperFactory.ObjectConvertor)}.
- */
- public final void testConvertList() {
-
-
- List objects = new ArrayList();
- objects.add(Boolean.TRUE);
- int size = objects.size();
- factory.convertList(objects, new ObjectWrapperFactory.ObjectConvertor() {
- public Object convert(Object o ) {
-
- return new Boolean(!((Boolean) o).booleanValue());
- }
- });
-
- assertEquals(size, objects.size());
- assertEquals(Boolean.FALSE, objects.get(0));
- }
-
- /**
- * Test method for {@link
org.richfaces.model.impl.expressive.ObjectWrapperFactory#unwrapList(java.util.List)}.
- */
- public final void testUnwrapList() {
- List objects = new ArrayList(10);
- int [] ints = new int[10];
- Random random = new Random();
- for(int i = 0; i < 10; i++) {
- ints[i] = random.nextInt();
- objects.add(new TestObj(String.valueOf(ints[i])));
- }
-
- List l1 = factory.wrapList(objects);
- List l2 = factory.unwrapList(l1);
-
- assertSame(objects, l1);
- assertSame(objects, l2);
- assertEquals(10, l2.size());
-
- for(int i = 0; i < 10; i++) {
- TestObj t = (TestObj) l2.get(i);
- assertEquals(String.valueOf(ints[i]), t.getName());
- }
-
- }
-
- /**
- * Test method for {@link
org.richfaces.model.impl.expressive.ObjectWrapperFactory#unwrapObject(java.lang.Object)}.
- */
- public final void testUnwrapObject() {
-
- TestObj t = new TestObj("20");
-
- JavaBeanWrapper wrapper = new JavaBeanWrapper(t, new HashMap());
-
- Object wrapped = factory.unwrapObject(wrapper);
-
- assertSame(t, wrapped);
-
- }
-
- /**
- * Test method for {@link
org.richfaces.model.impl.expressive.ObjectWrapperFactory#wrapList(java.util.List)}.
- */
- public final void testWrapList() {
- List objects = new ArrayList(10);
- int [] ints = new int[10];
- Random random = new Random();
- for(int i = 0; i < 10; i++) {
- ints[i] = random.nextInt();
- objects.add(new TestObj(String.valueOf(ints[i])));
- }
-
- List l1 = factory.wrapList(objects);
-
- assertSame(objects, l1);
- assertEquals(10, l1.size());
-
- for(int i = 0; i < 10; i++) {
- JavaBeanWrapper wrapper = (JavaBeanWrapper) l1.get(i);
- TestObj t = (TestObj) wrapper.getWrappedObject();
-
- String string = String.valueOf(ints[i]);
-
- assertEquals(string, t.getName());
-
- Object prop1 = wrapper.getProperty("name");
- //Object prop2 = wrapper.getProperty("#{abc.name}");
-
- assertNotNull(prop1);
- //assertNotNull(prop2);
- assertEquals(string, prop1);
- //assertEquals(string, prop2);
- }
- }
-
- /**
- * Test method for {@link
org.richfaces.model.impl.expressive.ObjectWrapperFactory#wrapObject(java.lang.Object)}.
- */
- public final void testWrapObject() {
- TestObj t = new TestObj("20");
-
-
-
- JavaBeanWrapper wrapper = factory.wrapObject(t);
-
- Object wrapped = wrapper.getWrappedObject();
-
- assertSame(t, wrapped);
-
- Object prop1 = wrapper.getProperty("name");
- //Object prop2 = wrapper.getProperty("#{abc.name}");
-
- assertNotNull(prop1);
- //assertNotNull(prop2);
- assertEquals("20", prop1);
- //assertEquals("20", prop2);
-
-
- }
-
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/SimplePropertyExpressionTest.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/SimplePropertyExpressionTest.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/SimplePropertyExpressionTest.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,76 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.model.impl.expressive;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.richfaces.model.impl.expressive.SimplePropertyExpression;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public class SimplePropertyExpressionTest extends AbstractAjax4JsfTestCase {
-
- final static String property = "name";
- private SimplePropertyExpression expression;
-
- /**
- * @param name
- */
- public SimplePropertyExpressionTest(String name) {
- super(name);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- public void setUp() throws Exception {
- super.setUp();
- expression = new SimplePropertyExpression("name",
facesContext.getELContext(), application.getELResolver());
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- public void tearDown() throws Exception {
- super.tearDown();
- expression = null;
- }
-
- /**
- * Test method for {@link
org.richfaces.model.impl.expressive.SimplePropertyExpression#evaluate(java.lang.Object)}.
- */
- public final void testEvaluate() {
- TestObj testObj = new TestObj("aaaa");
- Object prop = expression.evaluate(testObj);
- assertNotNull(prop);
- assertEquals("aaaa", prop);
- }
-
- /**
- * Test method for {@link
org.richfaces.model.impl.expressive.Expression#getExpressionString()}.
- */
- public final void testGetExpressionString() {
- assertEquals(property, expression.getExpressionString());
- }
-
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/ValueBindingExpressionTest.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/ValueBindingExpressionTest.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/ValueBindingExpressionTest.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,74 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.model.impl.expressive;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.richfaces.model.impl.expressive.ValueBindingExpression;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public class ValueBindingExpressionTest extends AbstractAjax4JsfTestCase {
-
- private ValueBindingExpression expression;
- static final String var = "obj";
- static final String el = "#{" + var + ".name}";
-
- public ValueBindingExpressionTest(String name) {
- super(name);
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
- */
- public void setUp() throws Exception {
- super.setUp();
- expression = new ValueBindingExpression(facesContext, el, var);
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
- */
- public void tearDown() throws Exception {
- super.tearDown();
- expression = null;
- }
-
- /**
- * Test method for {@link
org.richfaces.model.impl.expressive.ValueBindingExpression#evaluate(java.lang.Object)}.
- */
- public final void testEvaluate() {
- TestObj testObj = new TestObj("aaaa");
- Object prop = expression.evaluate(testObj);
- //assertNotNull(prop);
- //assertEquals("aaaa", prop);
- }
-
- /**
- * Test method for {@link
org.richfaces.model.impl.expressive.Expression#getExpressionString()}.
- */
- public final void testGetExpressionString() {
- assertEquals(el, expression.getExpressionString());
- }
-
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/WrappedBeanFilterTest.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/WrappedBeanFilterTest.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/model/impl/expressive/WrappedBeanFilterTest.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,72 +0,0 @@
-/**
- *
- */
-package org.richfaces.model.impl.expressive;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.ajax4jsf.tests.MockValueExpression;
-import org.richfaces.model.FilterField;
-
-import junit.framework.TestCase;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public class WrappedBeanFilterTest extends TestCase {
-
- private List<FilterField> filterFields;
- private WrappedBeanFilter filter;
- /**
- * @param name
- */
- public WrappedBeanFilterTest(String name) {
- super(name);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- filterFields = new LinkedList<FilterField>();
- filterFields.add(new FilterField(new MockValueExpression("keyTrue")));
- filter = new WrappedBeanFilter(filterFields);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- filter = null;
- filterFields = null;
- }
-
- /**
- * Test method for {@link
org.richfaces.model.impl.expressive.WrappedBeanFilter#WrappedBeanFilter(java.util.List)}.
- */
- public final void testWrappedBeanFilter() {
- WrappedBeanFilter beanFilter = new WrappedBeanFilter(filterFields);
- assertNotNull(beanFilter);
- }
-
- /**
- * Test method for {@link
org.richfaces.model.impl.expressive.WrappedBeanFilter#accept(org.richfaces.model.impl.expressive.JavaBeanWrapper)}.
- */
- public final void testAccept() {
- TestObj obj = new TestObj("TestObj");
- Map<String, Object> props = new HashMap<String, Object>();
- props.put("keyTrue", Boolean.TRUE);
- props.put("keyFalse", Boolean.FALSE);
- JavaBeanWrapper wrapper = new JavaBeanWrapper(obj, props);
- assertTrue(filter.accept(wrapper));
- filterFields.add(new FilterField(new MockValueExpression("keyFalse")));
- assertFalse(filter.accept(wrapper));
- }
-
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/CompositeRendererTest.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/CompositeRendererTest.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/CompositeRendererTest.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,486 +0,0 @@
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.Arrays;
-import java.util.Map;
-
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIForm;
-import javax.faces.component.UIInput;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.resource.InternetResource;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.apache.shale.test.mock.MockResponseWriter;
-
-public class CompositeRendererTest extends AbstractAjax4JsfTestCase {
-
- public CompositeRendererTest(String name) {
- super(name);
- }
-
- private CompositeRenderer compositeRenderer;
-
- public void setUp() throws Exception {
- super.setUp();
-
- this.compositeRenderer = new CompositeRenderer() {
-
- protected Class getComponentClass() {
- return UIComponent.class;
- }
- };
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- this.compositeRenderer = null;
- }
-
- public final void testDoDecodeFacesContextUIComponent() {
- MockDecodeContributor[] contributors = new MockDecodeContributor[5];
- for (int i = 0; i < contributors.length; i++) {
- contributors[i] = new MockDecodeContributor();
- compositeRenderer.addContributor(contributors[i]);
- }
-
- UIInput component = new UIInput();
- compositeRenderer.doDecode(facesContext, component);
-
- for (int i = 0; i < contributors.length; i++) {
- assertSame(compositeRenderer, contributors[i].getRenderer());
- assertSame(facesContext, contributors[i].getContext());
- assertSame(component, contributors[i].getComponent());
- }
- }
-
- public final void testMergeScriptOptionsScriptOptionsFacesContextUIComponent() {
- UIInput input = new UIInput();
-
- ScriptOptions inputOptions = new ScriptOptions(input);
- inputOptions.addOption("input", "1");
-
- ScriptOptions formOptions = new ScriptOptions(input);
- formOptions.addOption("form", "2");
-
- ScriptOptions options = new ScriptOptions(input);
- options.addOption("generic", "3");
-
- MockDecodeContributor inputContributor;
- MockDecodeContributor formContributor;
- MockDecodeContributor contributor;
- MockDecodeContributor nullContributor;
-
- inputContributor = new MockDecodeContributor(UIComponent.class, inputOptions);
- formContributor = new MockDecodeContributor(UIComponent.class, formOptions);
- contributor = new MockDecodeContributor(UIComponent.class, options);
- nullContributor = new MockDecodeContributor(UIComponent.class, (ScriptOptions) null);
-
- compositeRenderer.addContributor(contributor);
- compositeRenderer.addContributor(formContributor);
- compositeRenderer.addContributor(inputContributor);
- compositeRenderer.addContributor(nullContributor);
-
- ScriptOptions scriptOptions = new ScriptOptions(input);
- compositeRenderer.mergeScriptOptions(scriptOptions, facesContext, input);
- Map map = scriptOptions.getMap();
-
- assertEquals(3, map.size());
- assertEquals("1", map.get("input"));
- assertEquals("2", map.get("form"));
- assertEquals("3", map.get("generic"));
- }
-
- public final void testMergeScriptOptionsScriptOptionsFacesContextUIComponentClass() {
- UIInput input = new UIInput();
-
- ScriptOptions inputOptions = new ScriptOptions(input);
- inputOptions.addOption("input", "1");
-
- ScriptOptions formOptions = new ScriptOptions(input);
- formOptions.addOption("form", "2");
-
- ScriptOptions options = new ScriptOptions(input);
- options.addOption("generic", "3");
-
- MockDecodeContributor inputContributor;
- MockDecodeContributor formContributor;
- MockDecodeContributor contributor;
- MockDecodeContributor nullContributor;
-
- inputContributor = new MockDecodeContributor(UIInput.class, inputOptions);
- formContributor = new MockDecodeContributor(NamingContainer.class, formOptions);
- contributor = new MockDecodeContributor(UIComponent.class, options);
- nullContributor = new MockDecodeContributor(UIForm.class, (ScriptOptions) null);
-
- compositeRenderer.addContributor(contributor);
- compositeRenderer.addContributor(formContributor);
- compositeRenderer.addContributor(inputContributor);
- compositeRenderer.addContributor(nullContributor);
-
- ScriptOptions scriptOptions = new ScriptOptions(input);
- compositeRenderer.mergeScriptOptions(scriptOptions, facesContext, input,
UIForm.class);
- Map map = scriptOptions.getMap();
-
- assertEquals(2, map.size());
- assertEquals("2", map.get("form"));
- assertEquals("3", map.get("generic"));
- }
-
- public final void testGetScripts() {
- MockDecodeContributor inputContributor;
- MockDecodeContributor formContributor;
- MockDecodeContributor contributor;
-
- inputContributor = new MockDecodeContributor(UIComponent.class, new String[] {
"input_script" }, null);
- formContributor = new MockDecodeContributor(UIComponent.class, new String[] {
"form_script" }, null);
- contributor = new MockDecodeContributor(UIComponent.class, null, null);
-
- compositeRenderer.addContributor(contributor);
- compositeRenderer.addContributor(formContributor);
- compositeRenderer.addContributor(inputContributor);
-
- InternetResource[] scripts = compositeRenderer.getScripts();
-
- assertEquals(2, scripts.length);
-
- assertTrue(scripts[0].getKey().contains("org/richfaces/renderkit/form_script"));
- assertTrue(scripts[1].getKey().contains("org/richfaces/renderkit/input_script"));
- }
-
- public final void testGetStyles() {
- MockDecodeContributor inputContributor;
- MockDecodeContributor formContributor;
- MockDecodeContributor contributor;
-
- inputContributor = new MockDecodeContributor(UIComponent.class, null, new String[] {
"input_style" });
- formContributor = new MockDecodeContributor(UIComponent.class, null, new String[] {
"form_style" });
- contributor = new MockDecodeContributor(UIComponent.class, null, null);
-
- compositeRenderer.addContributor(contributor);
- compositeRenderer.addContributor(inputContributor);
- compositeRenderer.addContributor(formContributor);
-
- InternetResource[] scripts = compositeRenderer.getStyles();
-
- assertEquals(2, scripts.length);
-
- assertTrue(scripts[0].getKey().contains("org/richfaces/renderkit/input_style"));
- assertTrue(scripts[1].getKey().contains("org/richfaces/renderkit/form_style"));
- }
-
- public final void testGetScriptsClass() {
- MockDecodeContributor inputContributor;
- MockDecodeContributor formContributor;
- MockDecodeContributor contributor;
-
- inputContributor = new MockDecodeContributor(UIInput.class, new String[] {
"input_script" }, null);
- formContributor = new MockDecodeContributor(NamingContainer.class, new String[] {
"form_script" }, null);
- contributor = new MockDecodeContributor(UIComponent.class, null, null);
-
- compositeRenderer.addContributor(contributor);
- compositeRenderer.addContributor(formContributor);
- compositeRenderer.addContributor(inputContributor);
-
- InternetResource[] scripts = compositeRenderer.getScripts(UIInput.class);
-
- assertEquals(1, scripts.length);
-
- assertTrue(scripts[0].getKey().contains("org/richfaces/renderkit/input_script"));
-
- scripts = compositeRenderer.getScripts(NamingContainer.class);
-
- assertEquals(1, scripts.length);
-
- assertTrue(scripts[0].getKey().contains("org/richfaces/renderkit/form_script"));
-
- scripts = compositeRenderer.getStyles(String.class);
- assertNull(scripts);
- }
-
- public final void testGetStylesClass() {
- MockDecodeContributor inputContributor;
- MockDecodeContributor formContributor;
- MockDecodeContributor contributor;
-
- inputContributor = new MockDecodeContributor(UIInput.class, null, new String[] {
"input_style" });
- formContributor = new MockDecodeContributor(NamingContainer.class, null, new String[] {
"form_style" });
- contributor = new MockDecodeContributor(UIComponent.class, null, null);
-
- compositeRenderer.addContributor(contributor);
- compositeRenderer.addContributor(formContributor);
- compositeRenderer.addContributor(inputContributor);
-
- InternetResource[] styles = compositeRenderer.getStyles(UIInput.class);
-
- assertEquals(1, styles.length);
-
- assertTrue(styles[0].getKey().contains("org/richfaces/renderkit/input_style"));
-
- styles = compositeRenderer.getStyles(NamingContainer.class);
-
- assertEquals(1, styles.length);
- assertTrue(styles[0].getKey().contains("org/richfaces/renderkit/form_style"));
-
- styles = compositeRenderer.getStyles(String.class);
- assertNull(styles);
- }
-
- public final void testGetScriptContributionsStringFacesContextUIComponent() {
- MockDecodeContributor inputContributor;
- MockDecodeContributor formContributor;
- MockDecodeContributor contributor;
- MockDecodeContributor nullContributor;
-
- inputContributor = new MockDecodeContributor(UIComponent.class, ".1;");
- formContributor = new MockDecodeContributor(UIComponent.class, ".2;");
- contributor = new MockDecodeContributor(UIComponent.class, ".3;");
- nullContributor = new MockDecodeContributor(UIForm.class, (String) null);
-
- compositeRenderer.addContributor(contributor);
- compositeRenderer.addContributor(formContributor);
- compositeRenderer.addContributor(inputContributor);
- compositeRenderer.addContributor(nullContributor);
-
- UIInput input = new UIInput();
- input.getAttributes().put("test", ".testValue");
-
- String contributions = compositeRenderer.getScriptContributions("theVar",
facesContext, input);
-
- assertEquals("theVar.testValue.3;theVar.testValue.2;theVar.testValue.1;",
contributions);
- }
-
- public final void testGetScriptContributionsStringFacesContextUIComponentClass() {
- MockDecodeContributor inputContributor;
- MockDecodeContributor formContributor;
- MockDecodeContributor contributor;
- MockDecodeContributor nullContributor;
-
- inputContributor = new MockDecodeContributor(UIInput.class, ".input;");
- formContributor = new MockDecodeContributor(NamingContainer.class,
".namingContainer;");
- contributor = new MockDecodeContributor(UIComponent.class, ".generic;");
- nullContributor = new MockDecodeContributor(UIForm.class, (String) null);
-
- compositeRenderer.addContributor(contributor);
- compositeRenderer.addContributor(formContributor);
- compositeRenderer.addContributor(inputContributor);
- compositeRenderer.addContributor(nullContributor);
-
- UIInput input = new UIInput();
- input.getAttributes().put("test", ".testValue");
-
- String contributions = compositeRenderer.getScriptContributions("theVar",
facesContext, input,
- UIForm.class);
-
- assertEquals("theVar.testValue.generic;theVar.testValue.namingContainer;",
contributions);
- }
-
- public final void testAddContributor() {
- MockDecodeContributor[] contributors = new MockDecodeContributor[5];
- for (int i = 0; i < contributors.length; i++) {
- contributors[i] = new MockDecodeContributor();
- compositeRenderer.addContributor(contributors[i]);
- }
-
- assertTrue(Arrays.deepEquals(contributors, compositeRenderer.getContributors()));
- }
-
- public final void testContributorDecodeCallback() {
- MockDecodeContributor inputContributor;
- MockDecodeContributor formContributor;
-
- formContributor = new MockDecodeContributor(NamingContainer.class);
- inputContributor = new MockDecodeContributor(UIInput.class);
-
- compositeRenderer.addContributor(inputContributor);
- compositeRenderer.addContributor(formContributor);
-
- UIComponent component = new UIInput();
- compositeRenderer.doDecode(facesContext, component);
-
- assertSame(compositeRenderer, inputContributor.getRenderer());
- assertSame(facesContext, inputContributor.getContext());
- assertSame(component, inputContributor.getComponent());
-
- assertNull(formContributor.getRenderer());
- assertNull(formContributor.getContext());
- assertNull(formContributor.getComponent());
-
- inputContributor.reset();
- formContributor.reset();
-
- assertNull(inputContributor.getRenderer());
- assertNull(inputContributor.getContext());
- assertNull(inputContributor.getComponent());
-
- assertNull(formContributor.getRenderer());
- assertNull(formContributor.getContext());
- assertNull(formContributor.getComponent());
-
- component = new UIForm();
- compositeRenderer.doDecode(facesContext, component);
-
- assertSame(compositeRenderer, formContributor.getRenderer());
- assertSame(facesContext, formContributor.getContext());
- assertSame(component, formContributor.getComponent());
-
- assertNull(inputContributor.getRenderer());
- assertNull(inputContributor.getContext());
- assertNull(inputContributor.getComponent());
- }
-
- public final void testAddParameterEncoder() {
- MockAttributeParameterEncoder[] encoders = new MockAttributeParameterEncoder[5];
- for (int i = 0; i < encoders.length; i++) {
- encoders[i] = new MockAttributeParameterEncoder("aaa");
- compositeRenderer.addParameterEncoder(encoders[i]);
- }
-
- assertTrue(Arrays.deepEquals(encoders, compositeRenderer.getParameterEncoders()));
- }
-
- public final void testEncodeAttributeParameters() throws IOException {
-
- MockAttributeParameterEncoder encoder1 = new
MockAttributeParameterEncoder("Attribute");
- MockAttributeParameterEncoder encoder2 = new
MockAttributeParameterEncoder("MoreAttribute");
-
- compositeRenderer.addParameterEncoder(encoder1);
- compositeRenderer.addParameterEncoder(encoder2);
-
- UIInput input = new UIInput();
- input.getAttributes().put("Attribute", "testValue1");
- input.getAttributes().put("MoreAttribute", "testValue2");
-
- //ResponseWriter responseWriter = facesContext.getResponseWriter();
- StringWriter stringWriter = new StringWriter();
- MockResponseWriter responseWriter = new MockResponseWriter(stringWriter,
"text/html", "UTF8");
- facesContext.setResponseWriter(responseWriter);
-
- responseWriter.startDocument();
- responseWriter.startElement("span", input);
- compositeRenderer.encodeAttributeParameters(facesContext, input);
- responseWriter.endElement("span");
- responseWriter.endDocument();
-
- responseWriter.flush();
-
- String result = stringWriter.getBuffer().toString();
- assertTrue(result.contains("testAttribute=\"testValue1\""));
- assertTrue(result.contains("testMoreAttribute=\"testValue2\""));
- }
-}
-
-class MockDecodeContributor implements RendererContributor {
-
- private String[] scriptDependencies;
- private String[] styleDependencies;
-
- private String scriptContribution;
-
- private Class componentClass;
- private FacesContext context;
- private UIComponent component;
- private CompositeRenderer renderer;
- private ScriptOptions options;
-
- public MockDecodeContributor(Class componentClass, ScriptOptions options) {
- super();
-
- this.componentClass = componentClass;
- this.options = options;
- }
-
- public MockDecodeContributor() {
- this(UIComponent.class);
- }
-
- public MockDecodeContributor(Class componentClass) {
- super();
- this.componentClass = componentClass;
- }
-
- public MockDecodeContributor(Class componentClass, String scriptContribution) {
- super();
-
- this.componentClass = componentClass;
- this.scriptContribution = scriptContribution;
- }
-
- public MockDecodeContributor(Class componentClass, String[] scriptDependencies,
- String[] styleDependencies) {
- super();
-
- this.componentClass = componentClass;
- this.scriptDependencies = scriptDependencies;
- this.styleDependencies = styleDependencies;
- }
-
- public void decode(FacesContext context, UIComponent component,
- CompositeRenderer compositeRenderer) {
-
- this.component = component;
- this.context = context;
- this.renderer = compositeRenderer;
- }
-
- public Class getAcceptableClass() {
- return componentClass;
- }
-
- public String getScriptContribution(FacesContext context,
- UIComponent component) {
- return scriptContribution != null ? component.getAttributes().get("test") +
scriptContribution :
- null;
- }
-
- public String[] getScriptDependencies() {
- return scriptDependencies;
- }
-
- public String[] getStyleDependencies() {
- return styleDependencies;
- }
-
- public ScriptOptions buildOptions(FacesContext context,
- UIComponent component) {
- return options;
- }
-
- public UIComponent getComponent() {
- return component;
- }
-
- public FacesContext getContext() {
- return context;
- }
-
- public CompositeRenderer getRenderer() {
- return renderer;
- }
-
- public void reset() {
- this.component = null;
- this.context = null;
- this.renderer = null;
- }
-}
-
-class MockAttributeParameterEncoder implements AttributeParametersEncoder {
-
- private String attributeName;
-
- public MockAttributeParameterEncoder(String attributeName) {
- super();
- this.attributeName = attributeName;
- }
-
- public void doEncode(FacesContext context, UIComponent component)
- throws IOException {
-
- context.getResponseWriter().writeAttribute("test" + attributeName,
component.getAttributes().get(attributeName)
- , null);
- }
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/InputRendererBaseTest.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/InputRendererBaseTest.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/InputRendererBaseTest.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,190 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit;
-
-import java.util.List;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIForm;
-import javax.faces.component.UIInput;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-/**
- * @author Nick - mailto:nbelaevski@exadel.com
- * created 12.04.2007
- *
- */
-public class InputRendererBaseTest extends AbstractAjax4JsfTestCase {
-
- private static final String TYPE = "test.Type";
-
- private UIInput input;
-
- public InputRendererBaseTest(String name) {
- super(name);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- public void setUp() throws Exception {
- super.setUp();
-
- List children = facesContext.getViewRoot().getChildren();
- UIComponent form = application.createComponent(UIForm.COMPONENT_TYPE);
- children.add(form);
- input = (UIInput) createComponent(TYPE, UIInput.class.getName(),
"test.Renderer",
- InputRendererBase.class, null);
- form.getChildren().add(input);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- public void tearDown() throws Exception {
- super.tearDown();
-
- this.input = null;
- }
-
- public void testDoDecode() throws Exception {
- externalContext.addRequestParameterMap(
- input.getClientId(facesContext),
- "12;true");
-
- assertNull(input.getSubmittedValue());
- input.decode(facesContext);
- assertEquals("12;true", input.getSubmittedValue());
- assertTrue(input.isValid());
- }
-
- public void testDoSkipDecode() throws Exception {
- externalContext.addRequestParameterMap(
- input.getClientId(facesContext) + ":aaa",
- "12;true");
-
- assertNull(input.getSubmittedValue());
- input.decode(facesContext);
- assertNull(input.getSubmittedValue());
- assertTrue(input.isValid());
- }
-
- public void testGetConvertedValue() throws Exception {
- input.setConverter(new InputRendererBaseMockConverter());
- input.setSubmittedValue("12;true");
-
- assertTrue(input.isValid());
- input.validate(facesContext);
-
- InputRendererBaseMockConverterBean value =
- (InputRendererBaseMockConverterBean) input.getValue();
-
- assertEquals(12, value.getFirst());
- assertEquals(true, value.getSecond());
- }
-
- public void testGetInputValue() throws Exception {
- InputRendererBaseMockConverterBean value =
- new InputRendererBaseMockConverterBean();
-
- value.setFirst(44);
- value.setSecond(true);
-
- input.setValue(value);
- input.setConverter(new InputRendererBaseMockConverter());
-
- String strValue = new InputRendererBase().getInputValue(facesContext, input);
- assertEquals("44;true", strValue);
-
- input.setValue(null);
- strValue = new InputRendererBase().getInputValue(facesContext, input);
- assertEquals("", strValue);
-
- input.setValue(value);
- input.setSubmittedValue("444");
- strValue = new InputRendererBase().getInputValue(facesContext, input);
- assertEquals("444", strValue);
-
- input.setSubmittedValue(null);
- input.setValue(value);
- input.setConverter(null);
- strValue = new InputRendererBase().getInputValue(facesContext, input);
- assertEquals("true:44", strValue);
-
- input.setValue(null);
- input.setConverter(null);
- strValue = new InputRendererBase().getInputValue(facesContext, input);
- assertEquals("", strValue);
- }
-}
-
-class InputRendererBaseMockConverterBean {
-
- int first;
- boolean second;
- public int getFirst() {
- return first;
- }
- public void setFirst(int first) {
- this.first = first;
- }
- public boolean getSecond() {
- return second;
- }
- public void setSecond(boolean second) {
- this.second = second;
- }
-
- public String toString() {
- return second + ":" + first;
- }
-}
-
-class InputRendererBaseMockConverter implements Converter {
-
- /* (non-Javadoc)
- * @see javax.faces.convert.Converter#getAsObject(javax.faces.context.FacesContext,
javax.faces.component.UIComponent, java.lang.String)
- */
- public Object getAsObject(FacesContext context, UIComponent comp, String str) {
- InputRendererBaseMockConverterBean bean = new InputRendererBaseMockConverterBean();
- String[] values = str.split(";");
- bean.setFirst(Integer.parseInt(values[0]));
- bean.setSecond(Boolean.valueOf(values[1]).booleanValue());
- return bean;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.convert.Converter#getAsString(javax.faces.context.FacesContext,
javax.faces.component.UIComponent, java.lang.Object)
- */
- public String getAsString(FacesContext context, UIComponent comp, Object value) {
- if (value == null) {
- return null;
- }
-
- InputRendererBaseMockConverterBean bean = (InputRendererBaseMockConverterBean) value;
- return String.valueOf(bean.getFirst())+";"+String.valueOf(bean.getSecond());
- }
-
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/TemplateEncoderRendererBaseTest.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/TemplateEncoderRendererBaseTest.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/TemplateEncoderRendererBaseTest.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,64 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIOutput;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-/**
- * Created 26.10.2007
- * @author Nick Belaevski - mailto:nbelaevski@exadel.com
- * @since 3.2
- */
-
-public class TemplateEncoderRendererBaseTest extends AbstractAjax4JsfTestCase {
-
- public TemplateEncoderRendererBaseTest(String name) {
- super(name);
- }
-
- public void testEncodeNonRendered() throws Exception {
- setupResponseWriter();
-
- TemplateEncoderRendererBase rendererBase = new TemplateEncoderRendererBase() {
-
- @Override
- protected Class<? extends UIComponent> getComponentClass() {
- return UIOutput.class;
- }
- };
-
- UIOutput output = new UIOutput();
-
- UIOutput c = new UIOutput();
- c.setRendered(false);
- c.setValue("");
- output.getChildren().add(c);
-
- //that should not fail
- rendererBase.writeScriptBody(facesContext, c, true);
-
- processResponseWriter();
- }
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/TemplateUtilTest.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/TemplateUtilTest.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/TemplateUtilTest.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,45 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit;
-
-import java.io.StringReader;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.richfaces.javacc.RichMacroDefinition;
-
-/**
- * @author Nick Belaevski - mailto:nbelaevski@exadel.com
- * created 17.06.2007
- *
- */
-public class TemplateUtilTest extends TestCase {
-
-
- public void testAntlr() throws Exception {
- List result = new RichMacroDefinition(new StringReader("{aa{b\\}}a}\\\\
a\\}b\\{c")).expression();
- Expression holder = (Expression) result.get(0);
- assertEquals("aa{b}}a", holder.getExpression());
- assertEquals("\\ a}b{c", result.get(1));
- }
-}
Deleted: framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/Bean.java
===================================================================
--- framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/Bean.java 2009-07-12
22:53:07 UTC (rev 14902)
+++ framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/Bean.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,27 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.skin;
-
-public class Bean {
- public String getName(){return "bindedtest";}
- public String getBean(){return "binded.string";}
-}
\ No newline at end of file
Deleted: framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/SkinTestCase.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/SkinTestCase.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/SkinTestCase.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,240 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.skin;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.faces.FacesException;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-/**
- * Test for Skin/skin factory methods.
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/10 14:28:13 $
- *
- */
-public class SkinTestCase extends AbstractAjax4JsfTestCase {
-
- public SkinTestCase(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
- }
-
- public void tearDown() throws Exception {
- SkinFactory.reset();
- super.tearDown();
- }
-
- /*
- * Test method for 'org.richfaces.skin.SkinFactory.getInstance()'
- */
- public void testGetInstance() {
- SkinFactory factory = SkinFactory.getInstance();
- SkinFactory factory1 = SkinFactory.getInstance();
- assertSame(factory,factory1);
- }
-
- private void addParameters(Object[][] strings) {
- Map<Object,Object> baseMap = new HashMap<Object, Object>();
- for (Object[] objects : strings) {
- baseMap.put(objects[0], objects[1]);
- }
-
- externalContext.getRequestMap().put("test", baseMap);
- }
-
- /*
- * Test method for 'org.richfaces.skin.SkinFactory.getSkin(FacesContext)'
- */
- public void testGetSkin() {
- servletContext.addInitParameter(SkinFactory.SKIN_PARAMETER, "test");
-
- addParameters(new Object[][]{new Object[] {"bean", "test.value"}});
-
- SkinFactory factory = SkinFactory.getInstance();
- // test call
- Skin skin = factory.getSkin(facesContext);
- assertNotNull("Null skin!",skin);
- // test properties
- assertEquals("string",skin.getParameter(facesContext,
"string.property"));
- assertEquals("base.string",skin.getParameter(facesContext,
"base.property"));
- assertEquals("test.value",skin.getParameter(facesContext,
"bind.property"));
- // assertEquals("HTML_BASIC",skin.getRenderKitId(mockContext));
- }
-
- /*
- * Test method for 'org.richfaces.skin.SkinFactory.getSkin(FacesContext)'
- */
- public void testSkinReferences() {
- SkinFactory factory = SkinFactory.getInstance();
- servletContext.addInitParameter(SkinFactory.SKIN_PARAMETER, "test");
-
- // test call
- Skin skin = factory.getSkin(facesContext);
- assertNotNull("Null skin!",skin);
- assertEquals("default",skin.getParameter(facesContext, "c"));
- assertEquals("yyy",skin.getParameter(facesContext, "y"));
- }
-
- /*
- * Test method for 'org.richfaces.skin.SkinFactory.getSkin(FacesContext)'
- */
- public void testSkinReferences1() {
- SkinFactory factory = SkinFactory.getInstance();
- servletContext.addInitParameter(SkinFactory.SKIN_PARAMETER, "style");
- servletContext.addInitParameter(SkinFactory.BASE_SKIN_PARAMETER,
"style_base");
-
- // test call
- Skin skin = factory.getSkin(facesContext);
- assertNotNull("Null skin!",skin);
- assertEquals("#F5F0E7",skin.getParameter(facesContext,
"intermediateTextColor"));
- assertEquals("10px",skin.getParameter(facesContext,
"intermediateTextSize"));
- assertEquals("#F5F0E7",skin.getParameter(facesContext,
"generalTextColor"));
-
- assertEquals("white.textcolor",skin.getParameter(facesContext,
"additionalTextColor"));
- }
-
- public void testBaseSkin() {
- SkinFactory factory = SkinFactory.getInstance();
- servletContext.addInitParameter(SkinFactory.SKIN_PARAMETER, "dynatest");
- servletContext.addInitParameter(SkinFactory.BASE_SKIN_PARAMETER,
"dynatest_base");
- addParameters(new Object[][]{new Object[] {"bean", "dynabase1"}});
-
- Skin skin = factory.getSkin(facesContext);
- assertEquals("default", skin.getParameter(facesContext,
"default"));
- assertEquals("itself", skin.getParameter(facesContext,
"selfValue"));
- assertEquals("#AAA", skin.getParameter(facesContext,
"customFormColor"));
-
- Map map = (Map) externalContext.getRequestMap().get("test");
- map.put("bean", "dynabase2");
-
- assertEquals("xxx", skin.getParameter(facesContext, "default"));
- assertEquals("itself", skin.getParameter(facesContext,
"selfValue"));
- assertEquals("#AAA", skin.getParameter(facesContext,
"customFormColor"));
- }
-
- /*
- * Test method for 'org.richfaces.skin.SkinFactory.getSkin(FacesContext)'
- */
- public void testCyclicSkinReferences() {
- SkinFactory factory = SkinFactory.getInstance();
- servletContext.addInitParameter(SkinFactory.SKIN_PARAMETER, "cyclic");
-
- try {
- Skin skin = factory.getSkin(facesContext);
- skin.getParameter(facesContext, "x");
- fail();
- } catch(FacesException e){
- //it's ok
- }
- }
-
- /*
- * Test method for 'org.richfaces.skin.SkinFactory.getSkin(FacesContext)'
- */
- public void testBadSkinReferences() {
- SkinFactory factory = SkinFactory.getInstance();
- servletContext.addInitParameter(SkinFactory.SKIN_PARAMETER, "noref");
-
- // test call
- try {
- Skin skin = factory.getSkin(facesContext);
- skin.getParameter(facesContext, "x");
- fail();
- } catch(FacesException e){
- //it's ok
- }
- }
- /*
- * Test method for 'org.richfaces.skin.SkinFactory.getSkin(FacesContext)'
- */
- public void testGetBindedSkin() {
- SkinFactory factory = SkinFactory.getInstance();
- servletContext.addInitParameter(SkinFactory.SKIN_PARAMETER, "#{test.skin}");
-
- addParameters(new Object[][] {
- new Object[] {"skin", "bindedtest"},
- new Object[] {"bean", "binded.test.value"}
- });
-
- // test call
- Skin skin = factory.getSkin(facesContext);
- assertNotNull("Null skin!",skin);
- // test properties
- assertEquals("bindedstring",skin.getParameter(facesContext,
"string.property"));
- // assertEquals("base.string",skin.getParameter(mockContext,"base.property"));
- assertEquals("binded.test.value",skin.getParameter(facesContext,
"bind.property"));
- assertEquals("TEST",skin.getRenderKitId(facesContext));
- }
-
- public void testSkinHash() {
- SkinFactory factory = SkinFactory.getInstance();
- servletContext.addInitParameter(SkinFactory.SKIN_PARAMETER, "#{test.skin}");
-
- addParameters(new Object[][] {
- new Object[] {"skin", "bindedtest"},
- new Object[] {"bean", "binded.test.value"}
- });
-
- Skin skin = factory.getSkin(facesContext);
- Map<String, Object> requestMap =
facesContext.getExternalContext().getRequestMap();
-
- // test properties
- int hash = skin.hashCode(facesContext);
- assertTrue(requestMap.containsKey(BasicSkinImpl.REQUEST_HASH_CODES_MAP_PARAMETER));
- assertEquals(hash,skin.hashCode(facesContext));
- requestMap.remove(BasicSkinImpl.REQUEST_HASH_CODES_MAP_PARAMETER);
- assertEquals(hash,skin.hashCode(facesContext));
- // setup Value binding mock for different value - hash must differ.
- requestMap.remove(BasicSkinImpl.REQUEST_HASH_CODES_MAP_PARAMETER);
-
- Map map = (Map) requestMap.get("test");
- map.put("bean", "other.test.value");
-
- assertFalse( hash==skin.hashCode(facesContext) );
-
- }
- /*
- * Test method for 'org.richfaces.skin.SkinFactory.getDefaultProperties()'
- */
- public void testGetDefaultProperties() {
- SkinFactoryImpl factory = (SkinFactoryImpl) SkinFactory.getInstance();
- Properties defaultProps = factory.getDefaultSkinProperties();
- // assertEquals("HTML_BASIC",defaultProps.getProperty("render.kit"));
- // Second default config
- assertEquals("default",defaultProps.getProperty("a"));
- }
-
- /*
- * Test method for
'org.richfaces.skin.SkinFactory.getSkinName(FacesContext)'
- */
- public void testGetSkinName() {
-
- }
-
-}
Deleted: framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/SkinTests.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/SkinTests.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/SkinTests.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,39 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.skin;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class SkinTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(
- "Test for org.richfaces.skin");
- //$JUnit-BEGIN$
- suite.addTestSuite(SkinThreadsTestCase.class);
- suite.addTestSuite(SkinTestCase.class);
- //$JUnit-END$
- return suite;
- }
-
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/SkinThreadsTestCase.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/SkinThreadsTestCase.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/SkinThreadsTestCase.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,112 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.skin;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.tests.AbstractThreadedAjax4JsfTestCase;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: ishabalov $)
- * @version $Revision: 1.1.2.2 $ $Date: 2007/02/20 20:58:11 $
- *
- */
-public class SkinThreadsTestCase extends AbstractThreadedAjax4JsfTestCase {
-
- /**
- * @param s
- */
- public SkinThreadsTestCase(String s) {
- super(s);
- // TODO Auto-generated constructor stub
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.exadel.vcp.tests.VcpJsfTestCase#setUp()
- */
-public void setUp() throws Exception {
- // TODO Auto-generated method stub
- super.setUp();
- servletContext.setAttribute("skin", new Bean());
- }
- /*
- * (non-Javadoc)
- *
- * @see com.exadel.vcp.tests.VcpJsfTestCase#tearDown()
- */
- public void tearDown() throws Exception {
- // TODO Auto-generated method stub
- super.tearDown();
- }
-
-
- public class SkinTestRunnable extends TestCaseRunnable {
-
-
- /**
- *
- */
- public SkinTestRunnable() {
- // TODO Auto-generated constructor stub
- }
-
- /* (non-Javadoc)
- * @see
com.exadel.vcp.tests.ThreadedVcpJsfTestCase.TestCaseRunnable#runTestCase(javax.faces.context.FacesContext)
- */
- public void runTestCase(FacesContext context) throws Throwable {
- context.getExternalContext().getRequestMap().put("test", new Bean());
- Skin skin = SkinFactory.getInstance().getSkin(context);
- assertNotNull(skin);
- assertEquals("TEST", skin.getRenderKitId(context));
- assertEquals("binded.string", skin.getParameter(context,
"bind.property"));
- assertEquals("bindedstring", skin.getParameter(context,
"string.property"));
- assertEquals("10", skin.getParameter(context, "int.property"));
- assertNull(skin.getParameter(context, "notexist"));
- }
-
- }
-
- /**
- * Test skin factory for thread-safe.
- */
- public void testThreadsafe() {
- TestCaseRunnable[] runnables = new TestCaseRunnable[20];
- for (int i = 0; i < runnables.length; i++) {
- runnables[i] = new SkinTestRunnable();
-
- }
- this.runTestCaseRunnables(runnables);
- }
- /*
- * (non-Javadoc)
- *
- * @see com.exadel.vcp.tests.VcpJsfTestCase#getSkinName()
- */
- protected String getSkinName() {
- // TODO Auto-generated method stub
- return "#{skin.name}";
- }
-}
Deleted:
framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/TestApplicationFactory.java
===================================================================
---
framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/TestApplicationFactory.java 2009-07-12
22:53:07 UTC (rev 14902)
+++
framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/TestApplicationFactory.java 2009-07-12
22:54:01 UTC (rev 14903)
@@ -1,115 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.skin;
-
-
-
-import javax.faces.application.Application;
-
-import javax.faces.application.ApplicationFactory;
-
-
-
-import org.easymock.MockControl;
-
-import org.easymock.classextension.MockClassControl;
-
-
-
-/**
-
- * @author asmirnov(a)exadel.com (latest modification by $Author: ishabalov $)
-
- * @version $Revision: 1.1.2.2 $ $Date: 2007/02/20 20:58:11 $
-
- *
-
- */
-
-public class TestApplicationFactory extends ApplicationFactory {
-
-
-
- private MockControl applicationControl;
-
- private Application mockApplication;
-
-
-
- public TestApplicationFactory(){
-
- applicationControl = MockClassControl.createControl(Application.class);
-
- mockApplication = (Application) applicationControl.getMock();
-
- }
-
-
-
- /* (non-Javadoc)
-
- * @see javax.faces.application.ApplicationFactory#getApplication()
-
- */
-
- public Application getApplication() {
-
- // TODO Auto-generated method stub
-
- return mockApplication;
-
- }
-
-
-
- /* (non-Javadoc)
-
- * @see
javax.faces.application.ApplicationFactory#setApplication(javax.faces.application.Application)
-
- */
-
- public void setApplication(Application arg0) {
-
- // TODO Auto-generated method stub
-
-
-
- }
-
-
-
- /**
-
- * @return Returns the applicationControl.
-
- */
-
- public MockControl getApplicationControl() {
-
- return applicationControl;
-
- }
-
-
-
-}
-