Author: Alex.Kolonitsky
Date: 2010-03-18 12:02:15 -0400 (Thu, 18 Mar 2010)
New Revision: 16633
Removed:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ComponentLibraryTest.java
Log:
RF-8232 Tags support
remove visitor
fix checkstyle errors
Deleted:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ComponentLibraryTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ComponentLibraryTest.java 2010-03-18
16:01:28 UTC (rev 16632)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ComponentLibraryTest.java 2010-03-18
16:02:15 UTC (rev 16633)
@@ -1,146 +0,0 @@
-/*
- * $Id$
- *
- * 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.cdk.model;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.faces.render.RenderKitFactory;
-
-import org.junit.Test;
-
-/**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @author asmirnov(a)exadel.com
- *
- */
-public class ComponentLibraryTest {
-
- /**
- * Test method for
- * {@link
org.richfaces.cdk.model.ComponentLibrary#accept(org.richfaces.cdk.model.LibraryVisitor,
java.lang.Object)}
- * .
- *
- * @throws Exception
- */
- @Test
- public void testAcceptLibraryVisitorOfRPP() throws Exception {
- ComponentLibrary lib = new ComponentLibrary();
- final ComponentModel component = new
ComponentModel(FacesId.parseId("foo.Bar"));
- lib.getComponents().add(component);
- LibraryVisitor<Boolean, Boolean> visitor = new LibraryVisitor<Boolean,
Boolean>() {
- @Override
- public Boolean visit(Visitable c, Boolean param) {
- return component == c ? Boolean.TRUE : null;
- }
- };
-
- assertTrue(lib.accept(visitor, null));
- }
-
- /**
- * Test method for
- * {@link
org.richfaces.cdk.model.ComponentLibrary#findOrCreateRenderer(java.lang.String,
java.lang.String)}.
- */
- @Test
- public void testFindOrCreateRenderKit() {
- ComponentLibrary lib = new ComponentLibrary();
- RenderKitModel renderKit =
lib.addRenderKit(RenderKitFactory.HTML_BASIC_RENDER_KIT);
-
- assertNotNull(renderKit);
- assertSame(renderKit, lib.addRenderKit(RenderKitFactory.HTML_BASIC_RENDER_KIT));
- }
-
- /**
- * Test method for
- * {@link
org.richfaces.cdk.model.ComponentLibrary#merge(org.richfaces.cdk.model.Mergeable,
org.richfaces.cdk.model.Mergeable)}
- * .
- */
- @Test
- public void testMergeTT() {
- ModelBean foo = new ModelBean("foo");
-
- foo.setResult("Result");
- foo.setDoNotReplace("Important");
-
- ModelBean bar = new ModelBean("bar");
-
- bar.setVizited(true);
-
- Object result = new Object();
-
- bar.setResult(result);
- bar.readOnly = "readOnly";
- bar.writeOnly = "writeOnly";
- bar.setDoNotReplace("Replaced");
- ComponentLibrary.merge(foo, bar);
- assertSame(result, foo.getResult());
- assertEquals(new ModelBean.Type("foo"), foo.getType());
- assertTrue(foo.isVizited());
- assertEquals("Important", foo.getDoNotReplace());
- assertNull(foo.readOnly);
- assertNull(foo.writeOnly);
- }
-
- /**
- * Test method for
- * {@link org.richfaces.cdk.model.ComponentLibrary#accept(java.lang.Iterable,
org.richfaces.cdk.model.LibraryVisitor, java.lang.Object, java.lang.Object)}
- * .
- *
- * @throws Exception
- */
- @Test
- public void testAcceptIterableOfTLibraryVisitorOfRPPR() throws Exception {
- List<ModelBean> beans = new ArrayList<ModelBean>();
- ModelBean foo = new ModelBean("foo");
-
- foo.setResult("foo");
- beans.add(foo);
-
- ModelBean bar = new ModelBean("bar");
-
- beans.add(bar);
-
- LibraryVisitor<Object, String> visitor = new LibraryVisitor<Object,
String>() {
- @Override
- public Object visit(Visitable c, String param) {
- ModelBean bean = (ModelBean) c;
-
- bean.setDoNotReplace(param);
-
- return bean.getResult();
- }
- };
- Object result = ComponentLibrary.accept(beans, visitor, "visited",
null);
-
- assertTrue(foo.isVizited() || bar.isVizited());
- assertFalse(foo.isVizited() && bar.isVizited());
- assertEquals("foo", result);
- assertEquals("visited", foo.getDoNotReplace());
- }
-}
Show replies by date