Author: Alex.Kolonitsky
Date: 2010-01-14 14:05:04 -0500 (Thu, 14 Jan 2010)
New Revision: 16299
Added:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ConverterProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyConverter.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyValidator.java
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Key.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ModelBeanTest.java
Log:
https://jira.jboss.org/jira/browse/RF-8232
Tags support - Tests for convertor & validator processors
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java 2010-01-14
18:14:34 UTC (rev 16298)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java 2010-01-14
19:05:04 UTC (rev 16299)
@@ -21,16 +21,16 @@
package org.richfaces.cdk.apt;
-import java.lang.annotation.Annotation;
+import org.richfaces.cdk.CdkProcessingException;
+import org.richfaces.cdk.annotations.Converter;
+import org.richfaces.cdk.model.ClassDescription;
+import org.richfaces.cdk.model.ConverterModel;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.MirroredTypeException;
+import java.lang.annotation.Annotation;
-import org.richfaces.cdk.CdkProcessingException;
-import org.richfaces.cdk.annotations.Converter;
-import org.richfaces.cdk.model.ConverterModel;
-import org.richfaces.cdk.model.ClassDescription;
-
/**
* @author akolonitsky
* @since Jan 4, 2010
@@ -44,7 +44,12 @@
ConverterModel converterModel = new ConverterModel();
converterModel.setConverterId(converter.id());
- converterModel.setConverterForClass(converter.forClass());
+
+ try {
+ converterModel.setConverterForClass(new
ClassDescription(converter.forClass().getName()));
+ } catch (MirroredTypeException e) {
+ converterModel.setConverterForClass(new
ClassDescription(e.getTypeMirror().toString()));
+ }
converterModel.setConverterClass(new
ClassDescription(element.getQualifiedName().toString()));
setDescription(element, converterModel);
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-01-14
18:14:34 UTC (rev 16298)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-01-14
19:05:04 UTC (rev 16299)
@@ -210,8 +210,8 @@
* <p class="changed_added_4_0"></p>
* @param generate the generate to set
*/
- public void setGenerate(boolean exists) {
- this.generate = exists;
+ public void setGenerate(boolean generate) {
+ this.generate = generate;
}
/**
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java 2010-01-14
18:14:34 UTC (rev 16298)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java 2010-01-14
19:05:04 UTC (rev 16299)
@@ -38,7 +38,7 @@
private ClassDescription converterClass;
- private Class<?> converterForClass;
+ private ClassDescription converterForClass;
public ConverterModel() {
}
@@ -57,11 +57,11 @@
}
@Merge(false)
- public Class<?> getConverterForClass() {
+ public ClassDescription getConverterForClass() {
return converterForClass;
}
- public void setConverterForClass(Class<?> converterForClass) {
+ public void setConverterForClass(ClassDescription converterForClass) {
this.converterForClass = converterForClass;
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Key.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Key.java 2010-01-14
18:14:34 UTC (rev 16298)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Key.java 2010-01-14
19:05:04 UTC (rev 16299)
@@ -30,8 +30,9 @@
*
* @author asmirnov(a)exadel.com
*/
-@SuppressWarnings("serial")
public class Key implements Serializable {
+ private static final long serialVersionUID = -8199984910177820771L;
+
private final String type;
/**
Added:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java 2010-01-14
19:05:04 UTC (rev 16299)
@@ -0,0 +1,90 @@
+/**
+ * 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.apt;
+
+import org.richfaces.cdk.CdkTestBase;
+import org.richfaces.cdk.CdkContext;
+import org.richfaces.cdk.CdkContextBase;
+import org.richfaces.cdk.StandardSources;
+import org.richfaces.cdk.RichFacesConventions;
+import org.richfaces.cdk.NamingConventions;
+import org.richfaces.cdk.ModelValidator;
+import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.CdkProcessingException;
+import org.richfaces.cdk.CdkClassLoader;
+import org.richfaces.cdk.annotations.Family;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.ComponentModel;
+import com.google.common.collect.ImmutableList;
+
+import javax.el.ELContext;
+import javax.faces.component.UIComponent;
+
+/**
+ * @author akolonitsky
+ * @since Jan 14, 2010
+ */
+public abstract class AnnotationProcessorTest extends CdkTestBase {
+
+ protected ComponentLibrary prepareMockCompilationContext(String javaFilePath) throws
Exception {
+ CdkContext cdkContext = createMockContext();
+ CdkProcessor processor = new CdkProcessor();
+ AptBuilder compiler = new AptBuilder();
+
+ compiler.init(cdkContext);
+ processor.init(cdkContext);
+ compiler.process(ImmutableList.of(getJavaFile(javaFilePath)), processor);
+
+ return cdkContext.getLibrary();
+ }
+
+ protected CdkContext createMockContext() throws Exception {
+ CdkContextBase baseContext = new CdkContextBase(createClassLoader());
+ baseContext.setSourceFolders(StandardSources.JAVA_SOURCES, testSourceDirectory);
+ RichFacesConventions richFacesConventions = new RichFacesConventions();
+ baseContext.setWorker(NamingConventions.class, richFacesConventions);
+ baseContext.setWorker(ModelValidator.class, new ModelValidator() {
+
+ @Override
+ public void init(CdkContext context) {
+
+ }
+
+ @Override
+ public void verify(ComponentLibrary library) throws CdkException {
+ }
+ });
+ baseContext.sendError(new CdkProcessingException());
+
+ return baseContext;
+ }
+
+ @Override
+ protected CdkClassLoader createClassLoader() throws Exception {
+ return new
CdkClassLoader(ImmutableList.of(getLibraryFile("test.source.properties"),
+ getLibraryFile(ComponentModel.class),
+ getLibraryFile(ELContext.class),
+ getLibraryFile(Family.class),
+ getLibraryFile(UIComponent.class)),
+ this.getClass().getClassLoader());
+ }
+}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java 2010-01-14
18:14:34 UTC (rev 16298)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java 2010-01-14
19:05:04 UTC (rev 16299)
@@ -25,34 +25,16 @@
package org.richfaces.cdk.apt;
-import static org.easymock.EasyMock.*;
import static org.junit.Assert.*;
import java.util.Collection;
-import java.util.Collections;
import java.util.Map;
-import javax.el.ELContext;
-import javax.faces.component.UIComponent;
-
-import org.junit.Ignore;
import org.junit.Test;
-import org.richfaces.cdk.CdkClassLoader;
import org.richfaces.cdk.CdkContext;
-import org.richfaces.cdk.CdkContextBase;
-import org.richfaces.cdk.CdkException;
-import org.richfaces.cdk.CdkProcessingException;
-import org.richfaces.cdk.CdkTestBase;
-import org.richfaces.cdk.ModelValidator;
-import org.richfaces.cdk.NamingConventions;
-import org.richfaces.cdk.RichFacesConventions;
-import org.richfaces.cdk.StandardSources;
-import org.richfaces.cdk.annotations.Family;
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.Property;
-import org.richfaces.cdk.xmlconfig.FragmentParser;
-import org.richfaces.cdk.xmlconfig.JAXBBinding;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
@@ -64,7 +46,7 @@
* @author asmirnov(a)exadel.com
*
*/
-public class ComponentProcessorTest extends CdkTestBase {
+public class ComponentProcessorTest extends AnnotationProcessorTest {
private static final String COMPONENT_CLASS_JAVA =
"org/richfaces/cdk/test/component/AbstractTestComponent.java";
private static final String FACES_COMPONENT_CLASS_JAVA =
"org/richfaces/cdk/test/component/UITestCommand.java";
@@ -77,17 +59,7 @@
*/
@Test
public void testProcess() throws Exception {
-
- // Prepare Mock compilation context.
- CdkContext cdkContext = createMockContext();
- CdkProcessor processor = new CdkProcessor();
- AptBuilder compiler = new AptBuilder();
-
- compiler.init(cdkContext);
- processor.init(cdkContext);
- compiler.process(ImmutableList.of(getJavaFile(COMPONENT_CLASS_JAVA)),
processor);
-
- ComponentLibrary library = cdkContext.getLibrary();
+ ComponentLibrary library = prepareMockCompilationContext(COMPONENT_CLASS_JAVA);
Collection<ComponentModel> components = library.getComponents();
assertEquals(1, components.size());
@@ -107,17 +79,7 @@
*/
@Test
public void testProcessFacesComponent() throws Exception {
-
- // Prepare Mock compilation context.
- CdkContext cdkContext = createMockContext();
- CdkProcessor processor = new CdkProcessor();
- AptBuilder compiler = new AptBuilder();
-
- compiler.init(cdkContext);
- processor.init(cdkContext);
- compiler.process(ImmutableList.of(getJavaFile(FACES_COMPONENT_CLASS_JAVA)),
processor);
-
- ComponentLibrary library = cdkContext.getLibrary();
+ ComponentLibrary library =
prepareMockCompilationContext(FACES_COMPONENT_CLASS_JAVA);
Collection<ComponentModel> components = library.getComponents();
assertEquals(1, components.size());
@@ -128,34 +90,4 @@
assertEquals(0, attributes.size());
}
- private CdkContext createMockContext() throws Exception {
- CdkContextBase baseContext = new CdkContextBase(createClassLoader());
- baseContext.setSourceFolders(StandardSources.JAVA_SOURCES, testSourceDirectory);
- RichFacesConventions richFacesConventions = new RichFacesConventions();
- baseContext.setWorker(NamingConventions.class, richFacesConventions);
- baseContext.setWorker(ModelValidator.class, new ModelValidator() {
-
- @Override
- public void init(CdkContext context) {
-
- }
-
- @Override
- public void verify(ComponentLibrary library) throws CdkException {
- }
- });
- baseContext.sendError(new CdkProcessingException());
-
- return baseContext;
- }
-
- protected CdkClassLoader createClassLoader() throws Exception {
- return new
CdkClassLoader(ImmutableList.of(getLibraryFile("test.source.properties"),
- getLibraryFile(ComponentModel.class),
- getLibraryFile(ELContext.class),
- getLibraryFile(Family.class),
- getLibraryFile(UIComponent.class)),
- this.getClass().getClassLoader());
- }
-
}
Added:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ConverterProcessorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ConverterProcessorTest.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ConverterProcessorTest.java 2010-01-14
19:05:04 UTC (rev 16299)
@@ -0,0 +1,68 @@
+/**
+ * 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.apt;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import org.richfaces.cdk.CdkClassLoader;
+import org.richfaces.cdk.CdkContext;
+import org.richfaces.cdk.CdkContextBase;
+import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.CdkProcessingException;
+import org.richfaces.cdk.CdkTestBase;
+import org.richfaces.cdk.ModelValidator;
+import org.richfaces.cdk.NamingConventions;
+import org.richfaces.cdk.RichFacesConventions;
+import org.richfaces.cdk.StandardSources;
+import org.richfaces.cdk.annotations.Family;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.ConverterModel;
+import org.richfaces.cdk.model.ClassDescription;
+
+import javax.el.ELContext;
+import javax.faces.component.UIComponent;
+import java.util.Collection;
+
+/**
+ * @author akolonitsky
+ * @since Jan 14, 2010
+ */
+public class ConverterProcessorTest extends AnnotationProcessorTest {
+ private static final String COMPONENT_CLASS_JAVA =
"org/richfaces/cdk/test/component/MyConverter.java";
+
+ @Test
+ public void testProcess() throws Exception {
+ ComponentLibrary library = prepareMockCompilationContext(COMPONENT_CLASS_JAVA);
+ Collection<ConverterModel> converters = library.getConverters();
+
+ assertEquals(3, converters.size());
+
+ ConverterModel converterModel = Iterables.get(converters, 0);
+ ClassDescription forClass = converterModel.getConverterForClass();
+ if (forClass != null &&
!Object.class.getName().equals(forClass.getName())) {
+ assertEquals(Integer.class.getName(), forClass.getName());
+ }
+ }
+}
Added:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java 2010-01-14
19:05:04 UTC (rev 16299)
@@ -0,0 +1,52 @@
+/**
+ * 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.apt;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.ValidatorModel;
+
+import java.util.Collection;
+
+/**
+ * @author akolonitsky
+ * @since Jan 14, 2010
+ */
+public class ValidatorProcessorTest extends AnnotationProcessorTest {
+ private static final String VALIDATOR_CLASS_JAVA =
"org/richfaces/cdk/test/component/MyValidator.java";
+
+ @Test
+ public void testProcess() throws Exception {
+ ComponentLibrary library = prepareMockCompilationContext(VALIDATOR_CLASS_JAVA);
+ Collection<ValidatorModel> validators = library.getValidators();
+
+ assertEquals(2, validators.size());
+
+ for (ValidatorModel model: validators) {
+ String id = model.getValidatorId();
+ if (id != null && !id.isEmpty()) {
+ assertEquals("my_validator", model.getValidatorId());
+ }
+ }
+ }
+}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java 2010-01-14
18:14:34 UTC (rev 16298)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java 2010-01-14
19:05:04 UTC (rev 16299)
@@ -22,20 +22,13 @@
package org.richfaces.cdk.xmlconfig.testmodel;
import org.junit.Test;
-import org.junit.Ignore;
-import org.richfaces.cdk.CdkContextBase;
+import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.ConverterModel;
import org.richfaces.cdk.model.RenderKitModel;
import org.richfaces.cdk.model.RendererModel;
-import org.richfaces.cdk.model.ConverterModel;
-import org.richfaces.cdk.model.ClassDescription;
-import org.richfaces.cdk.xmlconfig.JAXBBinding;
-import org.richfaces.cdk.xmlconfig.FacesConfigGenerator;
-import org.richfaces.cdk.xmlconfig.JaxbTestBase;
-import org.richfaces.cdk.xmlconfig.model.FacesConfigAdapter;
-import javax.xml.transform.stream.StreamResult;
import java.io.StringWriter;
/**
@@ -48,7 +41,7 @@
public void testMarshalResultStringT() throws Exception {
ComponentLibrary library = new ComponentLibrary();
- ComponentModel component = new ComponentModel( new
ComponentModel.Type("foo.bar"));
+ ComponentModel component = new ComponentModel(new
ComponentModel.Type("foo.bar"));
library.getComponents().add(component);
RenderKitModel renderKit = library.addRenderKit("HTML");
RendererModel renderer = new RendererModel(new
RendererModel.Type("foo.Renderer"));
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ModelBeanTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ModelBeanTest.java 2010-01-14
18:14:34 UTC (rev 16298)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ModelBeanTest.java 2010-01-14
19:05:04 UTC (rev 16299)
@@ -21,27 +21,25 @@
package org.richfaces.cdk.xmlconfig.testmodel;
-import org.richfaces.cdk.xmlconfig.JaxbTestBase;
-import org.richfaces.cdk.xmlconfig.JAXBBinding;
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.Validator;
+import org.junit.Assert;
+import org.richfaces.cdk.CdkContextBase;
+import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.xmlconfig.FacesConfigGenerator;
+import org.richfaces.cdk.xmlconfig.JAXBBinding;
+import org.richfaces.cdk.xmlconfig.JaxbTestBase;
import org.richfaces.cdk.xmlconfig.model.FacesConfigAdapter;
-import org.richfaces.cdk.model.ComponentLibrary;
-import org.richfaces.cdk.CdkContextBase;
-import org.xml.sax.SAXException;
import org.xml.sax.InputSource;
-import org.custommonkey.xmlunit.Validator;
-import org.custommonkey.xmlunit.Diff;
-import org.junit.Assert;
+import org.xml.sax.SAXException;
import javax.xml.transform.stream.StreamResult;
-import java.io.StringWriter;
import java.io.File;
import java.io.IOException;
-import java.io.StringReader;
-import java.io.InputStreamReader;
import java.io.InputStream;
-import java.net.URL;
-import java.net.MalformedURLException;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.io.StringWriter;
/**
* @author akolonitsky
Added:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyConverter.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyConverter.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyConverter.java 2010-01-14
19:05:04 UTC (rev 16299)
@@ -0,0 +1,87 @@
+/**
+ * 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.test.component;
+
+import org.richfaces.cdk.annotations.Converter;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+
+/**
+ * @author akolonitsky
+ * @since Jan 14, 2010
+ */
+@Converter(id = "my_converter", forClass = Integer.class)
+public class MyConverter implements javax.faces.convert.Converter{
+
+ @Override
+ public Object getAsObject(FacesContext context, UIComponent component, String value)
{
+ return null;
+ }
+
+ @Override
+ public String getAsString(FacesContext context, UIComponent component, Object value)
{
+ return null;
+ }
+}
+
+@Converter(forClass = Integer.class)
+class MyConverter01 implements javax.faces.convert.Converter{
+
+ @Override
+ public Object getAsObject(FacesContext context, UIComponent component, String value)
{
+ return null;
+ }
+
+ @Override
+ public String getAsString(FacesContext context, UIComponent component, Object value)
{
+ return null;
+ }
+}
+
+@Converter(id = "my_converter_02")
+class MyConverter02 implements javax.faces.convert.Converter{
+
+ @Override
+ public Object getAsObject(FacesContext context, UIComponent component, String value)
{
+ return null;
+ }
+
+ @Override
+ public String getAsString(FacesContext context, UIComponent component, Object value)
{
+ return null;
+ }
+}
+
+@Converter
+class MyConverter03 implements javax.faces.convert.Converter{
+
+ @Override
+ public Object getAsObject(FacesContext context, UIComponent component, String value)
{
+ return null;
+ }
+
+ @Override
+ public String getAsString(FacesContext context, UIComponent component, Object value)
{
+ return null;
+ }
+}
Added:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyValidator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyValidator.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyValidator.java 2010-01-14
19:05:04 UTC (rev 16299)
@@ -0,0 +1,50 @@
+/**
+ * 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.test.component;
+
+import org.richfaces.cdk.annotations.Validator;
+
+import javax.faces.validator.ValidatorException;
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+
+/**
+ * @author akolonitsky
+ * @since Jan 14, 2010
+ */
+@Validator(id = "my_validator")
+public class MyValidator implements javax.faces.validator.Validator {
+
+ @Override
+ public void validate(FacesContext context, UIComponent component, Object value)
throws ValidatorException {
+
+ }
+}
+
+@Validator
+class MyValidator01 implements javax.faces.validator.Validator {
+
+ @Override
+ public void validate(FacesContext context, UIComponent component, Object value)
throws ValidatorException {
+
+ }
+}