Author: nbelaevski
Date: 2010-03-11 10:20:29 -0500 (Thu, 11 Mar 2010)
New Revision: 16558
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/behavior.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/converter.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taghandler.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taglib/validator.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/validator.ftl
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java
Log:
Fixes for failing CDK tests
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/behavior.ftl
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/behavior.ftl 2010-03-11
13:38:09 UTC (rev 16557)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/behavior.ftl 2010-03-11
15:20:29 UTC (rev 16558)
@@ -1,6 +1,6 @@
<#include "_copyright.ftl">
-package ${behaviorClass.package};
+package ${targetClass.package};
import javax.annotation.Generated;
import javax.faces.component.PartialStateHolder;
@@ -14,7 +14,7 @@
* ${description?if_exists}
**/
@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
-public class ${behaviorClass.simpleName} extends ${baseClass} implements Behavior,
PartialStateHolder {
+public class ${targetClass.simpleName} extends ${baseClass} implements Behavior,
PartialStateHolder {
@Override
public void broadcast(BehaviorEvent event) {
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/converter.ftl
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/converter.ftl 2010-03-11
13:38:09 UTC (rev 16557)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/converter.ftl 2010-03-11
15:20:29 UTC (rev 16558)
@@ -1,6 +1,6 @@
<#include "_copyright.ftl">
-package ${converterClass.package};
+package ${targetClass.package};
import javax.annotation.Generated;
import javax.faces.component.PartialStateHolder;
@@ -15,7 +15,7 @@
* ${description?if_exists}
**/
@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
-public class ${converterClass.simpleName} extends ${baseClass} implements Converter,
PartialStateHolder {
+public class ${targetClass.simpleName} extends ${baseClass} implements Converter,
PartialStateHolder {
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value)
{
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taghandler.ftl
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taghandler.ftl 2010-03-11
13:38:09 UTC (rev 16557)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taghandler.ftl 2010-03-11
15:20:29 UTC (rev 16558)
@@ -1,17 +1,17 @@
<#include "_copyright.ftl">
-package ${handler.package};
+package ${targetClass.package};
import javax.faces.view.facelets.*;
import org.richfaces.MethodMetadata;
-import ${model.generatedClass};
+import ${model.targetClass};
-public class ${handler.simpleName} extends ${handler.parent.simpleName} {
+public class ${targetClass.simpleName} extends ${baseClass.simpleName} {
- private static final ${handler.simpleName}MetaRule metaRule = new
${handler.simpleName}MetaRule();
+ private static final ${targetClass.simpleName}MetaRule metaRule = new
${targetClass.simpleName}MetaRule();
- public ${handler.simpleName}(${objectType}Config config) {
+ public ${targetClass.simpleName}(${objectType}Config config) {
super(config);
}
@@ -21,15 +21,15 @@
return m;
}
- static class ${handler.simpleName}MetaRule extends MetaRule{
+ static class ${targetClass.simpleName}MetaRule extends MetaRule{
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget
meta) {
- if (meta.isTargetInstanceOf(${model.generatedClass.simpleName}.class)) {
+ if (meta.isTargetInstanceOf(${model.targetClass.simpleName}.class)) {
<#list generatedAttributes as prop>
if ("${prop.name}".equals(name)) {
return new MethodMetadata(attribute) {
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((${model.generatedClass.simpleName})
instance).${prop.setterName}(<#if
(prop.isBinging)>getMethodBinding(ctx));<#else>getMethodExpression(ctx));</#if>
+ ((${model.targetClass.simpleName})
instance).${prop.setterName}(<#if
(prop.isBinging)>getMethodBinding(ctx));<#else>getMethodExpression(ctx));</#if>
}
};
}
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taglib/validator.ftl
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taglib/validator.ftl 2010-03-11
13:38:09 UTC (rev 16557)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taglib/validator.ftl 2010-03-11
15:20:29 UTC (rev 16558)
@@ -1,8 +1,8 @@
<tag>
- <tag-name>${validatorClass}</tag-name>
+ <tag-name>${targetClass}</tag-name>
<validator>
- <validator-id>${validatorId}</validator-id>
- <handler-class>${validatorClass}</handler-class>
+ <validator-id>${id}</validator-id>
+ <handler-class>${targetClass}</handler-class>
</validator>
<#list attributes as attribute>
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/validator.ftl
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/validator.ftl 2010-03-11
13:38:09 UTC (rev 16557)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/validator.ftl 2010-03-11
15:20:29 UTC (rev 16558)
@@ -1,6 +1,6 @@
<#include "_copyright.ftl">
-package ${validatorClass.package};
+package ${targetClass.package};
import javax.annotation.Generated;
import javax.faces.component.UIComponent;
@@ -15,7 +15,7 @@
* ${description?if_exists}
**/
@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
-public class ${validatorClass.simpleName} extends ${baseClass} implements Validator,
PartialStateHolder {
+public class ${targetClass.simpleName} extends ${baseClass} implements Validator,
PartialStateHolder {
@Override
public void validate(FacesContext context, UIComponent component, Object value)
throws ValidatorException {
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java 2010-03-11
13:38:09 UTC (rev 16557)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java 2010-03-11
15:20:29 UTC (rev 16558)
@@ -22,17 +22,28 @@
package org.richfaces.cdk.generate.java;
-import com.google.inject.Inject;
+import static org.easymock.EasyMock.anyInt;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+import java.io.StringWriter;
+
+import javax.faces.view.facelets.ComponentHandler;
+
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.easymock.EasyMock.*;
-import static org.easymock.EasyMock.verify;
-import org.richfaces.cdk.model.*;
import org.richfaces.cdk.CdkTestRunner;
+import org.richfaces.cdk.Mock;
+import org.richfaces.cdk.NamingConventions;
import org.richfaces.cdk.generate.java.taghandler.TagHandlerClassGenerator;
+import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.TagModel;
+import org.richfaces.cdk.model.validator.ValidatorImpl;
-import javax.faces.view.facelets.ComponentHandler;
-import java.io.StringWriter;
+import com.google.inject.Inject;
/**
* @author akolonitsky
@@ -41,9 +52,15 @@
@RunWith(CdkTestRunner.class)
public class TagHandlerClassGeneratorTest extends AbstractClassGeneratorTest {
+ @Mock
+ private NamingConventions namiingConventions;
+
@Inject
private TagHandlerClassGenerator generator;
+ @Inject
+ private ValidatorImpl validator;
+
@Test
public void testGetOutputFileBehavior() throws Exception {
final StringWriter outputWriter = new StringWriter();
@@ -58,7 +75,11 @@
tagModel.setName("mytag");
tagModel.setModel(model);
tagModel.setTargetClass(ClassName.parseName("org.richfaces.cdk.generate.java.GeneratedTagHandler"));
- tagModel.setTargetClass(ClassName.parseName(ComponentHandler.class.getName()));
+ tagModel.setBaseClass(ClassName.parseName(ComponentHandler.class.getName()));
+
+ //TODO nick - review
+ validator.verify();
+
generator.process(tagModel);
// System.out.println(outputWriter);