JBoss Rich Faces SVN: r16433 - branches/community/3.3.X/examples/photoalbum/source/ejb.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-02-09 10:58:13 -0500 (Tue, 09 Feb 2010)
New Revision: 16433
Modified:
branches/community/3.3.X/examples/photoalbum/source/ejb/pom.xml
Log:
Revert changes RF-8331
Modified: branches/community/3.3.X/examples/photoalbum/source/ejb/pom.xml
===================================================================
--- branches/community/3.3.X/examples/photoalbum/source/ejb/pom.xml 2010-02-09 15:41:29 UTC (rev 16432)
+++ branches/community/3.3.X/examples/photoalbum/source/ejb/pom.xml 2010-02-09 15:58:13 UTC (rev 16433)
@@ -76,6 +76,7 @@
<profiles>
<profile>
<id>livedemo</id>
+
<properties>
<imageset>full</imageset>
</properties>
@@ -88,17 +89,37 @@
<resource>
<directory>src/main/resources</directory>
</resource>
-
<resource>
+ <directory>${project.build.directory}/resources-filtered</directory>
+ </resource>
+ <resource>
<directory>sql/${imageset}</directory>
</resource>
-
</resources>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
- <version>2.3</version>
+ <version>2.3</version>
+ <executions>
+ <execution>
+ <id>copy-resources</id>
+ <!-- here the phase you need -->
+ <phase>validate</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/resources-filtered</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources-filtered</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
<plugin>
@@ -119,4 +140,4 @@
</plugin>
</plugins>
</build>
-</project>
+</project>
\ No newline at end of file
15 years, 7 months
JBoss Rich Faces SVN: r16432 - in branches/community/3.3.X/examples/photoalbum/source/ejb/src/main/resources: resources-filtered and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-02-09 10:41:29 -0500 (Tue, 09 Feb 2010)
New Revision: 16432
Added:
branches/community/3.3.X/examples/photoalbum/source/ejb/src/main/resources/resources-filtered/
branches/community/3.3.X/examples/photoalbum/source/ejb/src/main/resources/resources-filtered/components.properties
Log:
Revert changes RF-8331
Added: branches/community/3.3.X/examples/photoalbum/source/ejb/src/main/resources/resources-filtered/components.properties
===================================================================
--- branches/community/3.3.X/examples/photoalbum/source/ejb/src/main/resources/resources-filtered/components.properties (rev 0)
+++ branches/community/3.3.X/examples/photoalbum/source/ejb/src/main/resources/resources-filtered/components.properties 2010-02-09 15:41:29 UTC (rev 16432)
@@ -0,0 +1,4 @@
+#
+#Mon Sep 15 14:29:33 EEST 2008
+jndiPattern=photoalbum-ear-${project.version}/#{ejbName}/local
+embeddedEjb=false
15 years, 7 months
JBoss Rich Faces SVN: r16431 - in branches/community/3.3.X/examples/photoalbum/source: ear/src/main/application and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-02-09 10:39:51 -0500 (Tue, 09 Feb 2010)
New Revision: 16431
Removed:
branches/community/3.3.X/examples/photoalbum/source/ear/src/main/application/META-INF/
branches/community/3.3.X/examples/photoalbum/source/ejb/src/main/resources/META-INF/MANIFEST.MF
branches/community/3.3.X/examples/photoalbum/source/ejb/src/main/resources/components.properties
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/META-INF/MANIFEST.MF
Modified:
branches/community/3.3.X/examples/photoalbum/source/ear/pom.xml
branches/community/3.3.X/examples/photoalbum/source/ejb/pom.xml
branches/community/3.3.X/examples/photoalbum/source/web/pom.xml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/WEB-INF/components.xml
Log:
Revert changes RF-8331
Modified: branches/community/3.3.X/examples/photoalbum/source/ear/pom.xml
===================================================================
--- branches/community/3.3.X/examples/photoalbum/source/ear/pom.xml 2010-02-09 12:09:49 UTC (rev 16430)
+++ branches/community/3.3.X/examples/photoalbum/source/ear/pom.xml 2010-02-09 15:39:51 UTC (rev 16431)
@@ -8,7 +8,7 @@
</parent>
<groupId>org.richfaces.examples</groupId>
- <artifactId>photoalbum-ear</artifactId>
+ <artifactId>${projectName}-ear</artifactId>
<name>${appName} EAR module</name>
<packaging>ear</packaging>
@@ -30,12 +30,12 @@
<version>${project.version}</version>
<type>ejb</type>
</dependency>
- <dependency>
+ <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
- </dependency>
- <dependency>
+ </dependency>
+ <dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
<version>${seamVersion}</version>
@@ -61,7 +61,7 @@
</dependency>
</dependencies>
<build>
- <finalName>photoalbum-ear</finalName>
+ <finalName>${projectName}-ear-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -78,18 +78,15 @@
<generateApplicationXml>true</generateApplicationXml>
<includeJar>false</includeJar>
<defaultLibBundleDir>lib</defaultLibBundleDir>
- <version>5</version>
<modules>
<webModule>
<groupId>org.richfaces.examples</groupId>
- <artifactId>photoalbum-web</artifactId>
- <contextRoot>/photoalbum-web</contextRoot>
- <bundleFileName>photoalbum-web.war</bundleFileName>
+ <artifactId>${projectName}-web</artifactId>
+ <contextRoot>/${projectName}</contextRoot>
</webModule>
<ejbModule>
<groupId>org.richfaces.examples</groupId>
- <artifactId>photoalbum-ejb</artifactId>
- <bundleFileName>photoalbum-ejb.jar</bundleFileName>
+ <artifactId>${projectName}-ejb</artifactId>
</ejbModule>
<ejbModule>
<groupId>org.jboss.seam</groupId>
Modified: branches/community/3.3.X/examples/photoalbum/source/ejb/pom.xml
===================================================================
--- branches/community/3.3.X/examples/photoalbum/source/ejb/pom.xml 2010-02-09 12:09:49 UTC (rev 16430)
+++ branches/community/3.3.X/examples/photoalbum/source/ejb/pom.xml 2010-02-09 15:39:51 UTC (rev 16431)
@@ -10,7 +10,7 @@
</parent>
<groupId>org.richfaces.examples</groupId>
- <artifactId>photoalbum-ejb</artifactId>
+ <artifactId>${projectName}-ejb</artifactId>
<name>${appName} EJB module</name>
<packaging>ejb</packaging>
@@ -76,7 +76,6 @@
<profiles>
<profile>
<id>livedemo</id>
-
<properties>
<imageset>full</imageset>
</properties>
Deleted: branches/community/3.3.X/examples/photoalbum/source/ejb/src/main/resources/META-INF/MANIFEST.MF
===================================================================
--- branches/community/3.3.X/examples/photoalbum/source/ejb/src/main/resources/META-INF/MANIFEST.MF 2010-02-09 12:09:49 UTC (rev 16430)
+++ branches/community/3.3.X/examples/photoalbum/source/ejb/src/main/resources/META-INF/MANIFEST.MF 2010-02-09 15:39:51 UTC (rev 16431)
@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Class-Path:
-
Deleted: branches/community/3.3.X/examples/photoalbum/source/ejb/src/main/resources/components.properties
===================================================================
--- branches/community/3.3.X/examples/photoalbum/source/ejb/src/main/resources/components.properties 2010-02-09 12:09:49 UTC (rev 16430)
+++ branches/community/3.3.X/examples/photoalbum/source/ejb/src/main/resources/components.properties 2010-02-09 15:39:51 UTC (rev 16431)
@@ -1,4 +0,0 @@
-#
-#Mon Sep 15 14:29:32 EEST 2008
-jndiPattern=photoalbum-ear/#{ejbName}/local
-embeddedEjb=false
Modified: branches/community/3.3.X/examples/photoalbum/source/web/pom.xml
===================================================================
--- branches/community/3.3.X/examples/photoalbum/source/web/pom.xml 2010-02-09 12:09:49 UTC (rev 16430)
+++ branches/community/3.3.X/examples/photoalbum/source/web/pom.xml 2010-02-09 15:39:51 UTC (rev 16431)
@@ -10,7 +10,7 @@
</parent>
<groupId>org.richfaces.examples</groupId>
- <artifactId>photoalbum-web</artifactId>
+ <artifactId>${projectName}-web</artifactId>
<name>${appName} WAR module</name>
<packaging>war</packaging>
@@ -264,7 +264,6 @@
<goals>
<goal>export</goal>
</goals>
-
<configuration>
<connectionType>connection</connectionType>
<developerConnectionUrl>scm:svn:http://anonsvn.jboss.org/repos/richfaces/branches/examples-data/p...</developerConnectionUrl>
Deleted: branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/META-INF/MANIFEST.MF
===================================================================
--- branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/META-INF/MANIFEST.MF 2010-02-09 12:09:49 UTC (rev 16430)
+++ branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/META-INF/MANIFEST.MF 2010-02-09 15:39:51 UTC (rev 16431)
@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Class-Path:
-
Modified: branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/WEB-INF/components.xml
===================================================================
--- branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/WEB-INF/components.xml 2010-02-09 12:09:49 UTC (rev 16430)
+++ branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/WEB-INF/components.xml 2010-02-09 15:39:51 UTC (rev 16431)
@@ -10,17 +10,17 @@
xmlns:transaction="http://jboss.com/products/seam/transaction"
xmlns:web="http://jboss.com/products/seam/web"
xsi:schemaLocation=
- "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.1.xsd
- http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.1.xsd
- http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.1.xsd
- http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.1.xsd
- http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.1.xsd
- http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.1.xsd
- http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.1.xsd
- http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.1.xsd
- http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd">
+ "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.1.0.xsd
+ http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.1.0.xsd
+ http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.1.0.xsd
+ http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.1.0.xsd
+ http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.1.0.xsd
+ http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.1.0.xsd
+ http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.1.0.xsd
+ http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.1.0.xsd
+ http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.0.xsd">
- <core:init transaction-management-enabled="false" debug="true" jndi-pattern="@jndiPattern@"/>
+ <core:init transaction-management-enabled="false" debug="${environment.debug}" jndi-pattern="@jndiPattern@"/>
<core:manager concurrent-request-timeout="20000"
conversation-timeout="200000"
conversation-id-parameter="cid"
15 years, 7 months
JBoss Rich Faces SVN: r16430 - branches/enterprise.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-02-09 07:09:49 -0500 (Tue, 09 Feb 2010)
New Revision: 16430
Added:
branches/enterprise/3.3.1.SP1_RFPL-394/
Log:
create branch for RFPL-394
Copied: branches/enterprise/3.3.1.SP1_RFPL-394 (from rev 16429, tags/3.3.1.SP1)
15 years, 7 months
JBoss Rich Faces SVN: r16429 - in root/cdk/trunk/plugins/generator/src: main/java/org/richfaces/cdk/freemarker and 18 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-02-08 19:40:51 -0500 (Mon, 08 Feb 2010)
New Revision: 16429
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGeneratorBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibModule.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/ValidatorTaglibGenerator.java
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taglib/epilog.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taglib/prolog.ftl
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/taglib/
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/taglib/ValidatorTaglibGeneratorTest.java
Removed:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/ValidatorTaglibGenerator.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/freemarker/ValidatorTaglibGeneratorTest.java
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelElement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagLibrary.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/As.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/AsProvider.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkClassLoaderTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestBase.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestRunner.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/DependenciesGraph.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Mock.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/NamingConventionsTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/RunnerTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Stub.java
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/BehaviorProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.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/apt/TaskFactoryTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestAnnotation.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestAnnotation2.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestInterfaceAnnotation.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestMethodAnnotation.java
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/freemarker/FreeMarkerRendererTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ClassDescriptionTest.java
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/ModelBean.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/NameTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/Bean.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/Bean2.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/ELParserTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/TypesFactoryTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/UIComponent.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/XhtmlAttributesParsingTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/CdkResolverTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JAXBCopyTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbMarshalTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbTestBase.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbUnmarshalTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/Child.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/Id.java
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/Root.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/package-info.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodyMergeTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodySerializerTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodyTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XPathComparatorTest.java
root/cdk/trunk/plugins/generator/src/test/java/test/TestComponent.java
Log:
https://jira.jboss.org/jira/browse/RF-8360
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -36,6 +36,7 @@
import org.richfaces.cdk.apt.AptModule;
import org.richfaces.cdk.freemarker.FreeMakerModule;
import org.richfaces.cdk.generate.java.ClassGeneratorModule;
+import org.richfaces.cdk.generate.taglib.TaglibModule;
import org.richfaces.cdk.model.ModelModule;
import org.richfaces.cdk.templatecompiler.TemplateModule;
import org.richfaces.cdk.xmlconfig.XmlModule;
@@ -109,7 +110,7 @@
public void init(){
injector = Guice.createInjector(Stage.PRODUCTION,new CdkConfigurationModule(),new AptModule(),new ModelModule(),
- new ClassGeneratorModule(),new FreeMakerModule(),new TemplateModule(),new XmlModule());
+ new ClassGeneratorModule(),new FreeMakerModule(),new TemplateModule(),new XmlModule(),new TaglibModule());
// Create builder instance.
this.libraryBuilder = injector.getInstance(LibraryBuilder.class);
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -95,13 +95,9 @@
template.process(c, out);
out.close();
} catch (IOException e) {
-
- // TODO Auto-generated catch block
- e.printStackTrace();
+ throw new CdkException(e);
} catch (TemplateException e) {
-
- // TODO Auto-generated catch block
- e.printStackTrace();
+ throw new CdkException(e);
}
return false;
Deleted: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/ValidatorTaglibGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/ValidatorTaglibGenerator.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/ValidatorTaglibGenerator.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -1,64 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright , Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.cdk.freemarker;
-
-import java.io.File;
-
-import org.richfaces.cdk.CdkException;
-import org.richfaces.cdk.FileManager;
-import org.richfaces.cdk.OutputFolder;
-import org.richfaces.cdk.StandardOutputFolders;
-import org.richfaces.cdk.model.ComponentLibrary;
-import org.richfaces.cdk.model.ValidatorModel;
-import org.richfaces.cdk.model.Visitable;
-
-import com.google.inject.Inject;
-
-import freemarker.template.Configuration;
-
-/**
- * @author akolonitsky
- * @since Jan 18, 2010
- */
-public class ValidatorTaglibGenerator extends FreeMarkerRenderer<ValidatorModel, ComponentLibrary>{
-
- @Inject
- public ValidatorTaglibGenerator(Configuration configuration, ComponentLibrary library, @OutputFolder(StandardOutputFolders.RESOURCES)FileManager output) {
- super(configuration, library, output);
- }
-
- @Override
- protected String getOutputFile(ValidatorModel validatorModel) throws CdkException {
- return validatorModel.getValidatorClass().getName().replace('.', File.separatorChar) + "-taglib.xml";
- }
-
- @Override
- protected boolean isMyComponent(Visitable visitable) {
- return visitable instanceof ValidatorModel;
- }
-
- @Override
- protected String getTemplateName() {
- return "taglib/validator.ftl";
- }
-}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGenerator.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGenerator.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -0,0 +1,40 @@
+/*
+ * $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.generate.taglib;
+
+import java.io.Writer;
+
+import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.model.Visitable;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface TagGenerator<E extends Visitable> {
+
+ public void generate(E model,Writer out) throws CdkException;
+
+}
Property changes on: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGenerator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGeneratorBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGeneratorBase.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGeneratorBase.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -0,0 +1,66 @@
+/*
+ * $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.generate.taglib;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.model.Visitable;
+
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public abstract class TagGeneratorBase<T extends Visitable> implements TagGenerator<T>{
+
+ protected Template template;
+
+ public TagGeneratorBase(Configuration configuration) {
+ try {
+ template = configuration.getTemplate(getTemplateName());
+ } catch (IOException e) {
+ throw new CdkException(e);
+ }
+ }
+
+ @Override
+ public void generate(T model,Writer out) throws CdkException {
+ try {
+ template.process(model, out);
+ } catch (TemplateException e) {
+ throw new CdkException(e);
+ } catch (IOException e) {
+ throw new CdkException(e);
+ }
+ }
+
+ protected abstract String getTemplateName();
+
+}
Property changes on: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGeneratorBase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGenerator.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGenerator.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -0,0 +1,113 @@
+/*
+ * $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.generate.taglib;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Map;
+
+import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.CdkWriter;
+import org.richfaces.cdk.FileManager;
+import org.richfaces.cdk.OutputFolder;
+import org.richfaces.cdk.StandardOutputFolders;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.LibraryVisitor;
+import org.richfaces.cdk.model.Visitable;
+
+import com.google.inject.Inject;
+
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class TaglibGenerator implements CdkWriter, LibraryVisitor<Boolean, Writer> {
+
+ private final Map<Class<? extends Visitable>, TagGenerator<? extends Visitable>> tagGenerators;
+
+ private final Template prolog;
+
+ private final ComponentLibrary library;
+
+ private final FileManager output;
+
+ private Template epilog;
+
+ @Inject
+ public TaglibGenerator(Configuration configuration, ComponentLibrary library,
+ @OutputFolder(StandardOutputFolders.RESOURCES) FileManager output,
+ Map<Class<? extends Visitable>, TagGenerator<? extends Visitable>> tagGenerators) {
+ this.library = library;
+ this.output = output;
+ this.tagGenerators = tagGenerators;
+ try {
+ prolog = configuration.getTemplate("taglib/prolog.ftl");
+ epilog = configuration.getTemplate("taglib/epilog.ftl");
+ } catch (IOException e) {
+ throw new CdkException(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.CdkWriter#render()
+ */
+ @Override
+ public void render() throws CdkException {
+ // TODO - calculate library name.
+ try {
+ Writer writer =
+ output.createOutput("META-INF/" + library.getTagLibrary().getShortName() + ".taglib.xml", library
+ .lastModified());
+ if (null != writer) {
+ prolog.process(library, writer);
+ library.accept(this, writer);
+ epilog.process(library, writer);
+ writer.close();
+ }
+ } catch (IOException e) {
+ throw new CdkException(e);
+ } catch (TemplateException e) {
+ throw new CdkException(e);
+ }
+ }
+
+ @Override
+ public Boolean visit(Visitable c, Writer output) throws CdkException {
+ TagGenerator<Visitable> tagGenerator = (TagGenerator<Visitable>) tagGenerators.get(c.getClass());
+ if(null != tagGenerator){
+ tagGenerator.generate(c,output);
+ }
+ return false;
+ }
+
+}
Property changes on: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGenerator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibModule.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibModule.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibModule.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -0,0 +1,53 @@
+/*
+ * $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.generate.taglib;
+
+import org.richfaces.cdk.CdkWriter;
+import org.richfaces.cdk.model.ValidatorModel;
+import org.richfaces.cdk.model.Visitable;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.TypeLiteral;
+import com.google.inject.multibindings.MapBinder;
+import com.google.inject.multibindings.Multibinder;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class TaglibModule extends AbstractModule {
+
+ /* (non-Javadoc)
+ * @see com.google.inject.AbstractModule#configure()
+ */
+ @Override
+ protected void configure() {
+ Multibinder<CdkWriter> setBinder = Multibinder.newSetBinder(binder(),CdkWriter.class);
+ setBinder.addBinding().to(TaglibGenerator.class);
+ MapBinder<Class<? extends Visitable>, TagGenerator<? extends Visitable>> mapBinder = MapBinder.newMapBinder(binder(), new TypeLiteral<Class<? extends Visitable>>(){}, new TypeLiteral<TagGenerator<? extends Visitable>>(){});
+ mapBinder.addBinding(ValidatorModel.class).to(ValidatorTaglibGenerator.class);
+ }
+
+}
Property changes on: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibModule.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/ValidatorTaglibGenerator.java (from rev 16428, root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/ValidatorTaglibGenerator.java)
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/ValidatorTaglibGenerator.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/ValidatorTaglibGenerator.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright , Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.cdk.generate.taglib;
+
+import java.io.File;
+
+import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.FileManager;
+import org.richfaces.cdk.OutputFolder;
+import org.richfaces.cdk.StandardOutputFolders;
+import org.richfaces.cdk.freemarker.FreeMarkerRenderer;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.ValidatorModel;
+import org.richfaces.cdk.model.Visitable;
+
+import com.google.inject.Inject;
+
+import freemarker.template.Configuration;
+
+/**
+ * @author akolonitsky
+ * @since Jan 18, 2010
+ */
+public class ValidatorTaglibGenerator extends TagGeneratorBase<ValidatorModel>{
+
+
+
+
+ @Inject
+ public ValidatorTaglibGenerator(Configuration configuration) {
+ super(configuration);
+ }
+
+ @Override
+ protected String getTemplateName() {
+ return "taglib/validator.ftl";
+ }
+
+}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelElement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelElement.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelElement.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -2,5 +2,11 @@
import java.io.Serializable;
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ * @param <T>
+ */
public interface ModelElement<T extends ModelElement<? super T>>
extends Serializable, Mergeable<T>, Visitable {}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagLibrary.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagLibrary.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagLibrary.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -24,6 +24,7 @@
package org.richfaces.cdk.model;
import java.io.Serializable;
+import java.net.URI;
import java.util.ArrayList;
import java.util.List;
@@ -41,6 +42,9 @@
*/
private final List<Tag> tags = new ArrayList<Tag>();
+ private String shortName;
+
+ private URI uri;
/**
* <p class="changed_added_4_0"></p>
*
@@ -49,4 +53,32 @@
public List<Tag> getTags() {
return tags;
}
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the shortName
+ */
+ public String getShortName() {
+ return this.shortName;
+ }
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param shortName the shortName to set
+ */
+ public void setShortName(String shortName) {
+ this.shortName = shortName;
+ }
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the uri
+ */
+ public URI getUri() {
+ return this.uri;
+ }
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param uri the uri to set
+ */
+ public void setUri(URI uri) {
+ this.uri = uri;
+ }
}
Added: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taglib/epilog.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taglib/epilog.ftl (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taglib/epilog.ftl 2010-02-09 00:40:51 UTC (rev 16429)
@@ -0,0 +1,2 @@
+
+</facelet-taglib>
\ No newline at end of file
Added: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taglib/prolog.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taglib/prolog.ftl (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taglib/prolog.ftl 2010-02-09 00:40:51 UTC (rev 16429)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd" version="2.0">
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/As.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/As.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/As.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -29,12 +29,14 @@
import java.lang.annotation.Target;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@Retention(RetentionPolicy.RUNTIME)
-(a)Target({ElementType.FIELD})
+@Target( { ElementType.FIELD })
public @interface As {
public Class<?> value();
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/AsProvider.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/AsProvider.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/AsProvider.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -31,12 +31,14 @@
import com.google.inject.Provider;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@Retention(RetentionPolicy.RUNTIME)
-(a)Target({ElementType.FIELD})
+@Target( { ElementType.FIELD })
public @interface AsProvider {
public Class<? extends Provider<?>> value();
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkClassLoaderTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkClassLoaderTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkClassLoaderTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -8,24 +8,23 @@
import com.google.common.collect.Lists;
+public class CdkClassLoaderTest extends CdkTestBase {
-public class CdkClassLoaderTest extends CdkTestBase {
-
@Test
public void resourcePath() throws Exception {
File libraryFile = getLibraryFile("test.source.properties");
assertNotNull(libraryFile);
assertTrue(libraryFile.isDirectory());
}
-
+
@Test
public void resourcePath2() throws Exception {
File libraryFile = getLibraryFile("test.source.properties");
File libraryFile2 = getLibraryFile("org/richfaces/cdk/apt/test.html");
assertNotNull(libraryFile);
- assertEquals(libraryFile,libraryFile2);
+ assertEquals(libraryFile, libraryFile2);
}
-
+
@Test
public void resourcePath3() throws Exception {
File libraryFile = getLibraryFile("javax/faces/component/UIComponent.class");
@@ -33,11 +32,13 @@
assertFalse(libraryFile.isDirectory());
assertTrue(libraryFile.getName().contains("jsf-api"));
}
-
+
@Test
public void testClassLoader() throws Exception {
- Iterable<File> paths = Lists.newArrayList(getLibraryFile("test.source.properties"),getLibraryFile("javax/faces/component/UIComponent.class"));
- CdkClassLoader loader = new CdkClassLoader(paths,null);
+ Iterable<File> paths =
+ Lists.newArrayList(getLibraryFile("test.source.properties"),
+ getLibraryFile("javax/faces/component/UIComponent.class"));
+ CdkClassLoader loader = new CdkClassLoader(paths, null);
Class<?> class1 = loader.loadClass("javax.faces.application.Application");
assertNotNull(loader.getResource("javax/faces/FacesException.class"));
assertNotNull(loader.getResource("org/richfaces/cdk/apt/test.html"));
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestBase.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestBase.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,20 +21,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-
-import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.Charset;
-
import java.util.Collections;
import java.util.Locale;
import java.util.logging.LogManager;
@@ -48,14 +43,16 @@
import com.google.inject.Module;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
-public abstract class CdkTestBase implements Module {
-
+public abstract class CdkTestBase implements Module {
+
protected Iterable<File> testSourceDirectory;
-
+
protected File tempDir;
@Before
@@ -63,7 +60,7 @@
testSourceDirectory = Collections.singleton(getLibraryFile("test.source.properties"));
this.tempDir = File.createTempFile("cdk", "test");
-
+
InputStream stream = this.getClass().getResourceAsStream("logging.properties");
if (null != stream) {
@@ -87,7 +84,7 @@
public void tearDownSourceDirectory() {
testSourceDirectory = null;
}
-
+
@Override
public void configure(Binder binder) {
binder.bind(Locale.class).toInstance(Locale.getDefault());
@@ -105,11 +102,11 @@
protected File getLibraryFile(String resource) throws Exception {
URL url = this.getClass().getClassLoader().getResource(resource);
- if(null != url){
- if("file".equals(url.getProtocol())){
+ if (null != url) {
+ if ("file".equals(url.getProtocol())) {
String path = url.getPath();
// trim resource path
- path = path.substring(0, path.length()-resource.length());
+ path = path.substring(0, path.length() - resource.length());
File dir = new File(path);
return dir;
} else if ("jar".equals(url.getProtocol())) {
@@ -118,20 +115,21 @@
File file = new File(new URI(jarPath));
return file;
} else {
- throw new Exception("Unknown protocol "+url.getProtocol());
+ throw new Exception("Unknown protocol " + url.getProtocol());
}
} else {
- throw new Exception("Resource does not exists "+resource);
+ throw new Exception("Resource does not exists " + resource);
}
}
-
+
protected File getLibraryFile(Class<?> clazz) throws Exception {
- return getLibraryFile(clazz.getName().replaceAll("\\.", "/")+".class");
+ return getLibraryFile(clazz.getName().replaceAll("\\.", "/") + ".class");
}
- protected CdkClassLoader createClassLoader(){
+ protected CdkClassLoader createClassLoader() {
try {
- return new CdkClassLoader(ImmutableList.of(getLibraryFile("test.source.properties"),getLibraryFile(Component.class)), null);
+ return new CdkClassLoader(ImmutableList.of(getLibraryFile("test.source.properties"),
+ getLibraryFile(Component.class)), null);
} catch (Exception e) {
throw new RuntimeException(e);
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestRunner.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestRunner.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestRunner.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -41,28 +41,30 @@
import com.google.inject.AbstractModule;
import com.google.inject.BindingAnnotation;
import com.google.inject.Guice;
-import com.google.inject.ImplementedBy;
import com.google.inject.Injector;
import com.google.inject.Module;
-import com.google.inject.ProvidedBy;
import com.google.inject.Provider;
import com.google.inject.TypeLiteral;
import com.google.inject.binder.AnnotatedBindingBuilder;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
public class CdkTestRunner extends BlockJUnit4ClassRunner {
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @param klass
- * @throws InitializationError
* @throws InitializationError
+ * @throws InitializationError
*/
- public CdkTestRunner(Class<?> klass) throws InitializationError {
+ public CdkTestRunner(Class<?> klass) throws InitializationError {
super(klass);
}
@@ -71,91 +73,89 @@
*/
protected Set<Field> getFields(Class<?> c) {
Set<Field> fields = Sets.newHashSet(c.getDeclaredFields());
- while ( (c = c.getSuperclass()) != null ) {
- for ( Field f : c.getDeclaredFields() ) {
- if ( !Modifier.isStatic(f.getModifiers())
- && !Modifier.isPrivate(f.getModifiers())
- ) {
+ while ((c = c.getSuperclass()) != null) {
+ for (Field f : c.getDeclaredFields()) {
+ if (!Modifier.isStatic(f.getModifiers()) && !Modifier.isPrivate(f.getModifiers())) {
fields.add(f);
}
}
}
return fields;
}
-
+
@Override
protected void runChild(FrameworkMethod method, RunNotifier notifier) {
super.runChild(method, notifier);
}
-
+
@Override
protected Object createTest() throws Exception {
Class<?> c = getTestClass().getJavaClass();
Set<Field> testFields = getFields(c);
-
-
+
// make sure we have one (and only one) @Unit field
-// Field unitField = getUnitField(testFields);
-// if ( unitField.getAnnotation(Mock.class) != null ) {
-// throw new IncompatibleAnnotationException(Unit.class, Mock.class);
-// }
-//
- final Map<Field,Binding> fieldValues = getMockValues(testFields);
-// if ( fieldValues.containsKey(unitField)) {
-// throw new IncompatibleAnnotationException(Unit.class, unitField.getType());
-// }
-
+ // Field unitField = getUnitField(testFields);
+ // if ( unitField.getAnnotation(Mock.class) != null ) {
+ // throw new IncompatibleAnnotationException(Unit.class, Mock.class);
+ // }
+ //
+ final Map<Field, Binding> fieldValues = getMockValues(testFields);
+ // if ( fieldValues.containsKey(unitField)) {
+ // throw new IncompatibleAnnotationException(Unit.class, unitField.getType());
+ // }
+
Object test = createTest(c, fieldValues);
// any field values created by AtUnit but not injected by the container are injected here.
- for ( Field field : fieldValues.keySet() ) {
+ for (Field field : fieldValues.keySet()) {
Binding binding = fieldValues.get(field);
field.setAccessible(true);
- if ( null != binding.value && field.get(test) == null ) {
+ if (null != binding.value && field.get(test) == null) {
field.set(test, binding.value);
}
}
-
+
return test;
}
private Object createTest(Class<?> testClass, Map<Field, Binding> fieldValues) throws Exception {
FieldModule fields = new FieldModule(fieldValues);
-
+
Injector injector;
- if ( Module.class.isAssignableFrom(testClass)) {
- injector = Guice.createInjector(fields, (Module)testClass.newInstance() );
+ if (Module.class.isAssignableFrom(testClass)) {
+ injector = Guice.createInjector(fields, (Module) testClass.newInstance());
} else {
injector = Guice.createInjector(fields);
}
return injector.getInstance(testClass);
}
-
-
- protected class FieldModule extends AbstractModule {
- final Map<Field,Binding> fields;
-
- public FieldModule(Map<Field,Binding> fields) {
+
+ protected static final class FieldModule extends AbstractModule {
+ final Map<Field, Binding> fields;
+
+ public FieldModule(Map<Field, Binding> fields) {
this.fields = fields;
}
-
+
@Override
@SuppressWarnings("unchecked")
protected void configure() {
-
+
// map field values by type
- for ( Field field : fields.keySet() ) {
+ for (Field field : fields.keySet()) {
TypeLiteral literal = TypeLiteral.get(field.getGenericType());
AnnotatedBindingBuilder builder = bind(literal);
// Check field annotations.
Annotation[] fieldAnnotations = field.getAnnotations();
for (Annotation annotation : fieldAnnotations) {
Class<? extends Annotation> annotationType = annotation.annotationType();
- if(/*annotationType.isAnnotationPresent(Qualifier.class)||*/ annotationType.isAnnotationPresent(BindingAnnotation.class)){
+ if (/* annotationType.isAnnotationPresent(Qualifier.class)|| */annotationType
+ .isAnnotationPresent(BindingAnnotation.class)) {
Implementation implementation = annotationType.getAnnotation(Implementation.class);
- if(null != implementation){
+ if (null != implementation) {
try {
- Annotation value = implementation.value().getConstructor(annotationType).newInstance(annotation);
+ Annotation value =
+ implementation.value().getConstructor(annotationType).newInstance(annotation);
builder.annotatedWith(value);
} catch (SecurityException e) {
throw new RuntimeException(e);
@@ -176,7 +176,7 @@
}
}
Binding binding = fields.get(field);
- if(null != binding.value){
+ if (null != binding.value) {
builder.toInstance(binding.value);
} else if (null != binding.implementation) {
builder.to(binding.implementation);
@@ -186,22 +186,22 @@
}
}
}
-
- private static class Binding {
+
+ protected static final class Binding {
private Object value;
private Class<?> implementation;
private Class<? extends Provider<?>> provider;
}
private Map<Field, Binding> getMockValues(Set<Field> testFields) {
- Map<Field,Binding> mocksAndStubs = new HashMap<Field,Binding>();
-
- for ( Field field : testFields ) {
- if ( field.getAnnotation(Mock.class) != null ) {
+ Map<Field, Binding> mocksAndStubs = new HashMap<Field, Binding>();
+
+ for (Field field : testFields) {
+ if (field.getAnnotation(Mock.class) != null) {
Binding bind = new Binding();
bind.value = EasyMock.createStrictMock(field.getType());
mocksAndStubs.put(field, bind);
- } else if ( field.getAnnotation(Stub.class) != null ) {
+ } else if (field.getAnnotation(Stub.class) != null) {
Binding bind = new Binding();
bind.value = EasyMock.createNiceMock(field.getType());
mocksAndStubs.put(field, bind);
@@ -215,9 +215,8 @@
mocksAndStubs.put(field, bind);
}
}
-
+
return mocksAndStubs;
}
-
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/DependenciesGraph.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/DependenciesGraph.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/DependenciesGraph.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -24,14 +24,19 @@
package org.richfaces.cdk;
/**
- * <p class="changed_added_4_0">This application should create GraphVis .dot file with Cdk dependencies</p>
+ * <p class="changed_added_4_0">
+ * This application should create GraphVis .dot file with Cdk dependencies
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
public class DependenciesGraph {
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @param args
*/
public static void main(String[] args) {
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -1,32 +1,15 @@
-
/**
*
*/
package org.richfaces.cdk;
-import static org.junit.Assert.*;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-import org.richfaces.cdk.xmlutils.XMLBodyMergeTest;
-import org.richfaces.cdk.xmlutils.XMLBodySerializerTest;
-import org.richfaces.cdk.xmlutils.XMLBodyTest;
-import org.richfaces.cdk.xmlutils.XPathComparatorTest;
-
/**
* @author asmirnov
- *
+ *
*/
public class LibraryBuilderTest extends CdkTestBase {
@@ -34,17 +17,20 @@
* @throws java.lang.Exception
*/
@Before
- public void setUp() throws Exception {}
+ public void setUp() throws Exception {
+ }
/**
* @throws java.lang.Exception
*/
@After
- public void tearDown() throws Exception {}
+ public void tearDown() throws Exception {
+ }
/**
* Test method for {@link org.richfaces.cdk.LibraryBuilder#createInstance()}.
- * @throws Exception
+ *
+ * @throws Exception
*/
@Test
public void testInit() throws Exception {
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Mock.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Mock.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Mock.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -29,12 +29,14 @@
import java.lang.annotation.Target;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@Retention(RetentionPolicy.RUNTIME)
-(a)Target({ElementType.FIELD})
+@Target( { ElementType.FIELD })
public @interface Mock {
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/NamingConventionsTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/NamingConventionsTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/NamingConventionsTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk;
import static org.junit.Assert.*;
@@ -31,12 +29,12 @@
import org.junit.Before;
import org.junit.Test;
-import org.richfaces.cdk.model.InvalidNameException;
-
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
public class NamingConventionsTest {
private static final String BASE = "foo.bar";
@@ -53,7 +51,9 @@
}
/**
- * Test method for {@link org.richfaces.cdk.RichFacesConventions#inferComponentType(java.lang.String, java.lang.String)}.
+ * Test method for
+ * {@link org.richfaces.cdk.RichFacesConventions#inferComponentType(java.lang.String, java.lang.String)}.
+ *
* @throws Exception
*/
@Test
@@ -62,7 +62,9 @@
}
/**
- * Test method for {@link org.richfaces.cdk.RichFacesConventions#inferComponentType(java.lang.String, java.lang.String)}.
+ * Test method for
+ * {@link org.richfaces.cdk.RichFacesConventions#inferComponentType(java.lang.String, java.lang.String)}.
+ *
* @throws Exception
*/
@Test
@@ -71,7 +73,9 @@
}
/**
- * Test method for {@link org.richfaces.cdk.RichFacesConventions#inferComponentType(java.lang.String, java.lang.String)}.
+ * Test method for
+ * {@link org.richfaces.cdk.RichFacesConventions#inferComponentType(java.lang.String, java.lang.String)}.
+ *
* @throws Exception
*/
@Test
@@ -80,7 +84,9 @@
}
/**
- * Test method for {@link org.richfaces.cdk.RichFacesConventions#inferComponentType(java.lang.String, java.lang.String)}.
+ * Test method for
+ * {@link org.richfaces.cdk.RichFacesConventions#inferComponentType(java.lang.String, java.lang.String)}.
+ *
* @throws Exception
*/
@Test
@@ -89,7 +95,9 @@
}
/**
- * Test method for {@link org.richfaces.cdk.RichFacesConventions#inferComponentType(java.lang.String, java.lang.String)}.
+ * Test method for
+ * {@link org.richfaces.cdk.RichFacesConventions#inferComponentType(java.lang.String, java.lang.String)}.
+ *
* @throws Exception
*/
@Test
@@ -98,21 +106,24 @@
}
/**
- * Test method for {@link org.richfaces.cdk.RichFacesConventions#inferUIComponentClass(java.lang.String, java.lang.String, java.lang.String, boolean)}.
+ * Test method for
+ * {@link org.richfaces.cdk.RichFacesConventions#inferUIComponentClass(java.lang.String, java.lang.String, java.lang.String, boolean)}
+ * .
*/
@Test
public void testInferUIComponentClassFromExplicit() throws Exception {
- assertEquals("foo.bar.UITest",
- conventions.inferUIComponentClass("foo.bar.Test", "foo.bar.UITest", "foo.bar.AbstractClass",
- true));
+ assertEquals("foo.bar.UITest", conventions.inferUIComponentClass("foo.bar.Test", "foo.bar.UITest",
+ "foo.bar.AbstractClass", true));
}
/**
- * Test method for {@link org.richfaces.cdk.RichFacesConventions#inferUIComponentClass(java.lang.String, java.lang.String, java.lang.String, boolean)}.
+ * Test method for
+ * {@link org.richfaces.cdk.RichFacesConventions#inferUIComponentClass(java.lang.String, java.lang.String, java.lang.String, boolean)}
+ * .
*/
@Test
public void testInferUIComponentClassFromType() throws Exception {
- assertEquals("foo.bar.component.UITest",
- conventions.inferUIComponentClass("foo.bar.Test", "", "foo.bar.AbstractClass", true));
+ assertEquals("foo.bar.component.UITest", conventions.inferUIComponentClass("foo.bar.Test", "",
+ "foo.bar.AbstractClass", true));
}
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/RunnerTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/RunnerTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/RunnerTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -1,37 +1,35 @@
package org.richfaces.cdk;
-import static org.junit.Assert.*;
import static org.easymock.EasyMock.*;
+import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
-
@RunWith(CdkTestRunner.class)
public class RunnerTest {
-
+
@Mock
private Logger log;
-
+
@Stub
@Source(StandardSources.JAVA_SOURCES)
FileManager sources;
-
@Test
public void easyMockInjections() throws Exception {
assertNotNull(log);
assertNotNull(sources);
- replay(log,sources);
- verify(log,sources);
+ replay(log, sources);
+ verify(log, sources);
}
-
+
@Test
public void easyMockInjections2() throws Exception {
assertNotNull(log);
assertNotNull(sources);
- replay(log,sources);
- verify(log,sources);
+ replay(log, sources);
+ verify(log, sources);
}
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Stub.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Stub.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Stub.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -29,12 +29,14 @@
import java.lang.annotation.Target;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@Retention(RetentionPolicy.RUNTIME)
-(a)Target({ElementType.FIELD})
+@Target( { ElementType.FIELD })
public @interface Stub {
}
Modified: 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 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -22,7 +22,6 @@
package org.richfaces.cdk.apt;
import java.io.File;
-import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.List;
@@ -38,7 +37,6 @@
import org.richfaces.cdk.SourceFileManager;
import org.richfaces.cdk.SourceImpl;
import org.richfaces.cdk.StandardSources;
-import org.richfaces.cdk.Stub;
import org.richfaces.cdk.annotations.Family;
import org.richfaces.cdk.model.ComponentModel;
@@ -51,7 +49,7 @@
* @since Jan 14, 2010
*/
public abstract class AnnotationProcessorTest extends CdkTestBase {
-
+
@Inject
@Source(StandardSources.JAVA_SOURCES)
protected FileManager sources;
@@ -69,7 +67,8 @@
for (String src : sources()) {
sourceFiles.add(getJavaFile(src));
}
- binder.bind(FileManager.class).annotatedWith(new SourceImpl(StandardSources.JAVA_SOURCES)).toInstance(new SourceFileManager(sourceFiles, this.testSourceDirectory));
+ binder.bind(FileManager.class).annotatedWith(new SourceImpl(StandardSources.JAVA_SOURCES)).toInstance(
+ new SourceFileManager(sourceFiles, this.testSourceDirectory));
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -77,18 +76,15 @@
}
protected abstract Iterable<String> sources();
-
+
@Override
- protected CdkClassLoader createClassLoader() {
+ protected CdkClassLoader createClassLoader() {
try {
return new CdkClassLoader(ImmutableList.of(getLibraryFile("test.source.properties"),
- getLibraryFile(ComponentModel.class),
- getLibraryFile(ELContext.class),
- getLibraryFile(Family.class),
- getLibraryFile(UIComponent.class)),
- this.getClass().getClassLoader());
- } catch (Exception e) {
- throw new RuntimeException(e);
+ getLibraryFile(ComponentModel.class), getLibraryFile(ELContext.class), getLibraryFile(Family.class),
+ getLibraryFile(UIComponent.class)), this.getClass().getClassLoader());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
}
}
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/BehaviorProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/BehaviorProcessorTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/BehaviorProcessorTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -22,8 +22,11 @@
package org.richfaces.cdk.apt;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
+import java.util.Collection;
+import java.util.Collections;
+
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -33,9 +36,6 @@
import com.google.inject.Inject;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* @author akolonitsky
* @since Jan 21, 2010
@@ -54,14 +54,14 @@
assertEquals(2, behaviors.size());
- for (BehaviorModel model: behaviors) {
+ for (BehaviorModel model : behaviors) {
String id = model.getBehaviorId();
if (id != null && !id.isEmpty()) {
assertEquals("my_behavior", id);
}
}
}
-
+
@Override
protected Iterable<String> sources() {
return Collections.singleton(BEHAVIOR_CLASS_JAVA);
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,19 +21,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.apt;
import static org.easymock.EasyMock.*;
-import java.lang.annotation.Annotation;
import java.util.Collections;
import java.util.Set;
import javax.annotation.processing.Processor;
import javax.annotation.processing.RoundEnvironment;
-import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.TypeElement;
@@ -42,7 +38,6 @@
import org.richfaces.cdk.CdkTestRunner;
import org.richfaces.cdk.FileManager;
import org.richfaces.cdk.LibraryBuilder;
-import org.richfaces.cdk.Logger;
import org.richfaces.cdk.Mock;
import org.richfaces.cdk.ModelBuilder;
import org.richfaces.cdk.ModelValidator;
@@ -57,16 +52,12 @@
import com.google.inject.Singleton;
import com.google.inject.TypeLiteral;
-import static org.junit.Assert.*;
-
-
-
/**
* <p class="changed_added_4_0">
* </p>
- *
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@RunWith(CdkTestRunner.class)
public class CdkProcessorTest extends AnnotationProcessorTest {
@@ -76,28 +67,26 @@
private static final String INTERFACE_JAVA = "org/richfaces/cdk/apt/TestInterface.java";
private static final String SUB_CLASS_JAVA = "org/richfaces/cdk/apt/TestSubClass.java";
private static final ImmutableSet<String> PROCESS_ANNOTATIONS = ImmutableSet.of(TestAnnotation.class.getName());
-
+
@Inject
private CdkProcessor processor;
-
-
-
+
@Stub
@OutputFolder(StandardOutputFolders.JAVA_CLASSES)
private FileManager output;
-
+
@Inject
private CdkAnnotationProcessor cdkProcessor;
-
+
@Mock
private RoundEnvironment roundEnv;
-
+
@Mock
private TypeElement element;
-
+
@Mock
private LibraryBuilder builder;
-
+
@Mock
private ModelValidator validator;
@@ -108,56 +97,64 @@
binder.bind(Processor.class).to(CdkProcessor.class);
CdkAnnotationProcessor cdkProcessor = createMock(CdkAnnotationProcessor.class);
binder.bind(CdkAnnotationProcessor.class).toInstance(cdkProcessor);
- binder.bind(new TypeLiteral<Set<CdkAnnotationProcessor>>(){}).toInstance(ImmutableSet.of(cdkProcessor));
- binder.bind(new TypeLiteral<Set<ModelBuilder>>(){}).toInstance(Collections.<ModelBuilder>emptySet());
+ binder.bind(new TypeLiteral<Set<CdkAnnotationProcessor>>() {
+ }).toInstance(ImmutableSet.of(cdkProcessor));
+ binder.bind(new TypeLiteral<Set<ModelBuilder>>() {
+ }).toInstance(Collections.<ModelBuilder> emptySet());
}
-
+
@Override
protected Iterable<String> sources() {
- return ImmutableList.of(CLASS_JAVA,INTERFACE_JAVA,SUB_CLASS_JAVA);
+ return ImmutableList.of(CLASS_JAVA, INTERFACE_JAVA, SUB_CLASS_JAVA);
}
@Test
public void testProcess() throws Exception {
expect(roundEnv.processingOver()).andReturn(false);
- expect((Class<TestAnnotation2>)cdkProcessor.getProcessedAnnotation()).andStubReturn(TestAnnotation2.class);
- expect((Set<TypeElement>)roundEnv.getElementsAnnotatedWith(TestAnnotation2.class)).andReturn(Collections.singleton(element));
+ expect((Class<TestAnnotation2>) cdkProcessor.getProcessedAnnotation()).andStubReturn(TestAnnotation2.class);
+ expect((Set<TypeElement>) roundEnv.getElementsAnnotatedWith(TestAnnotation2.class)).andReturn(
+ Collections.singleton(element));
expect(element.getKind()).andReturn(ElementKind.CLASS);
- cdkProcessor.process(element);expectLastCall();
- validator.verify();expectLastCall();
- replay(element,roundEnv,builder,validator,cdkProcessor);
+ cdkProcessor.process(element);
+ expectLastCall();
+ validator.verify();
+ expectLastCall();
+ replay(element, roundEnv, builder, validator, cdkProcessor);
processor.process(Collections.singleton(element), roundEnv);
- verify(element,roundEnv,builder,validator,cdkProcessor);
+ verify(element, roundEnv, builder, validator, cdkProcessor);
}
-
+
@Test
public void testProcessOver() throws Exception {
expect(roundEnv.processingOver()).andReturn(true);
expect(log.getErrorCount()).andReturn(0);
- builder.generate();expectLastCall();
- replay(log,element,roundEnv,builder,validator,cdkProcessor);
+ builder.generate();
+ expectLastCall();
+ replay(log, element, roundEnv, builder, validator, cdkProcessor);
processor.process(Collections.singleton(element), roundEnv);
- verify(log,element,roundEnv,builder,validator,cdkProcessor);
+ verify(log, element, roundEnv, builder, validator, cdkProcessor);
}
-
+
@Test
public void testProcessOver2() throws Exception {
expect(roundEnv.processingOver()).andReturn(true);
expect(log.getErrorCount()).andReturn(1);
- replay(log,element,roundEnv,builder,validator,cdkProcessor);
+ replay(log, element, roundEnv, builder, validator, cdkProcessor);
processor.process(Collections.singleton(element), roundEnv);
- verify(log,element,roundEnv,builder,validator,cdkProcessor);
+ verify(log, element, roundEnv, builder, validator, cdkProcessor);
}
@Test
public void testProcess3() throws Exception {
expect(roundEnv.processingOver()).andReturn(false);
- expect((Class<TestAnnotation>)cdkProcessor.getProcessedAnnotation()).andStubReturn(TestAnnotation.class);
- expect((Set<TypeElement>)roundEnv.getElementsAnnotatedWith(TestAnnotation.class)).andReturn(Collections.<TypeElement>emptySet());
- validator.verify();expectLastCall();
- replay(element,roundEnv,builder,validator,cdkProcessor);
+ expect((Class<TestAnnotation>) cdkProcessor.getProcessedAnnotation()).andStubReturn(TestAnnotation.class);
+ expect((Set<TypeElement>) roundEnv.getElementsAnnotatedWith(TestAnnotation.class)).andReturn(
+ Collections.<TypeElement> emptySet());
+ validator.verify();
+ expectLastCall();
+ replay(element, roundEnv, builder, validator, cdkProcessor);
processor.process(Collections.singleton(element), roundEnv);
- verify(element,roundEnv,builder,validator,cdkProcessor);
+ verify(element, roundEnv, builder, validator, cdkProcessor);
}
}
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-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,12 +21,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.apt;
-import static org.junit.Assert.*;
import static org.easymock.EasyMock.*;
+import static org.junit.Assert.*;
import java.lang.annotation.Annotation;
import java.util.Collection;
@@ -41,7 +39,6 @@
import org.richfaces.cdk.CdkTestRunner;
import org.richfaces.cdk.Mock;
import org.richfaces.cdk.NamingConventions;
-import org.richfaces.cdk.Stub;
import org.richfaces.cdk.annotations.Component;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
@@ -50,14 +47,13 @@
import com.google.common.collect.Iterables;
import com.google.inject.Inject;
-import com.google.inject.Provider;
/**
* <p class="changed_added_4_0">
* </p>
- *
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@RunWith(CdkTestRunner.class)
public class ComponentProcessorTest extends AnnotationProcessorTest {
@@ -66,47 +62,46 @@
@Inject
private ComponentProcessor processor;
-
+
@Inject
private ComponentLibrary library;
-
-
+
@Mock
private SourceUtils utils;
-
+
@Mock
private TypeElement componentElement;
-
+
@Mock
private JAXB jaxb;
-
+
@Mock
private NamingConventions conventions;
+
/**
* Test method for
- * {@link org.richfaces.cdk.apt.CdkProcessor#process(java.util.Set, javax.annotation.processing.RoundEnvironment)}
- * .
- *
+ * {@link org.richfaces.cdk.apt.CdkProcessor#process(java.util.Set, javax.annotation.processing.RoundEnvironment)} .
+ *
* @throws Exception
*/
@Test
@Ignore
public void testProcess() throws Exception {
expect(componentElement.getAnnotation(Component.class)).andReturn(new Component() {
-
+
@Override
public Class<? extends Annotation> annotationType() {
return Component.class;
}
-
+
@Override
public String value() {
return "foo.Bar";
}
});
- replay(log,utils,componentElement,jaxb,conventions);
+ replay(log, utils, componentElement, jaxb, conventions);
processor.process(componentElement);
- verify(log,utils,componentElement,jaxb,conventions);
+ verify(log, utils, componentElement, jaxb, conventions);
Collection<ComponentModel> components = library.getComponents();
assertEquals(1, components.size());
@@ -117,7 +112,6 @@
assertEquals(3, attributes.size());
}
-
@Override
protected Iterable<String> sources() {
return Collections.singleton(COMPONENT_CLASS_JAVA);
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -29,7 +29,6 @@
import java.util.Collections;
import java.util.Set;
-
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.Processor;
import javax.annotation.processing.RoundEnvironment;
@@ -44,21 +43,20 @@
import org.junit.runner.RunWith;
import org.richfaces.cdk.CdkTestRunner;
import org.richfaces.cdk.FileManager;
-import org.richfaces.cdk.Logger;
import org.richfaces.cdk.Mock;
import org.richfaces.cdk.OutputFolder;
-import org.richfaces.cdk.Source;
import org.richfaces.cdk.StandardOutputFolders;
-import org.richfaces.cdk.StandardSources;
import org.richfaces.cdk.Stub;
import com.google.common.collect.ImmutableList;
import com.google.inject.Inject;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@RunWith(CdkTestRunner.class)
public class TaskFactoryTest extends AnnotationProcessorTest {
@@ -67,56 +65,56 @@
private static final String SUB_CLASS_JAVA = "org/richfaces/cdk/apt/TestSubClass.java";
private static final String INTERFACE_JAVA = "org/richfaces/cdk/apt/TestInterface.java";
-
@Inject
private TaskFactoryImpl factory;
-
-
+
@Mock
Processor processor;
-
+
@Stub
@OutputFolder(StandardOutputFolders.JAVA_CLASSES)
private FileManager output;
-
+
/**
* Test method for {@link org.richfaces.cdk.apt.TaskFactoryImpl#get()}.
- * @throws Exception
- * @throws AptException
+ *
+ * @throws Exception
+ * @throws AptException
*/
@Test
public void testGetTask() throws AptException, Exception {
expect(output.getFolders()).andReturn(null);
- replay(log,processor,output);
+ replay(log, processor, output);
CompilationTask task = factory.get();
assertNotNull(task);
- verify(log,processor,output);
+ verify(log, processor, output);
}
@Test
public void testTask() throws AptException, Exception {
expect(output.getFolders()).andReturn(null);
- processor.init((ProcessingEnvironment) anyObject());expectLastCall();
+ processor.init((ProcessingEnvironment) anyObject());
+ expectLastCall();
expect(processor.getSupportedSourceVersion()).andReturn(SourceVersion.RELEASE_6);
expect(processor.getSupportedAnnotationTypes()).andReturn(Collections.singleton("*"));
- expect(processor.getSupportedOptions()).andReturn(Collections.<String>emptySet());
+ expect(processor.getSupportedOptions()).andReturn(Collections.<String> emptySet());
// processor.process(null,null);
Capture<Set<? extends TypeElement>> capturedTypes = new Capture<Set<? extends TypeElement>>(CaptureType.FIRST);
- expect(processor.process(capture(capturedTypes),
- EasyMock.<RoundEnvironment>anyObject())).andReturn(true).times(2);
- replay(log,processor,output);
- CompilationTask task = factory.get();
+ expect(processor.process(capture(capturedTypes), EasyMock.<RoundEnvironment> anyObject())).andReturn(true)
+ .times(2);
+ replay(log, processor, output);
+ CompilationTask task = factory.get();
assertTrue(task.call());
Set<? extends TypeElement> elements = capturedTypes.getValue();
assertFalse(elements.isEmpty());
assertEquals("TestAnnotation2", elements.iterator().next().getSimpleName().toString());
- verify(log,processor,output);
+ verify(log, processor, output);
}
@Override
protected Iterable<String> sources() {
- return ImmutableList.of(CLASS_JAVA,SUB_CLASS_JAVA);
+ return ImmutableList.of(CLASS_JAVA, SUB_CLASS_JAVA);
}
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestAnnotation.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestAnnotation.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestAnnotation.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.apt;
import java.lang.annotation.Documented;
@@ -31,9 +29,11 @@
import java.lang.annotation.Target;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@Inherited
@Documented
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestAnnotation2.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestAnnotation2.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestAnnotation2.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.apt;
import java.lang.annotation.Documented;
@@ -31,9 +29,11 @@
import java.lang.annotation.Target;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@Inherited
@Documented
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestInterfaceAnnotation.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestInterfaceAnnotation.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestInterfaceAnnotation.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.apt;
import java.lang.annotation.Documented;
@@ -31,11 +29,14 @@
import java.lang.annotation.Target;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@Inherited
@Documented
@Target(ElementType.TYPE)
-public @interface TestInterfaceAnnotation {}
+public @interface TestInterfaceAnnotation {
+}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestMethodAnnotation.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestMethodAnnotation.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TestMethodAnnotation.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.apt;
import java.lang.annotation.Documented;
@@ -31,9 +29,11 @@
import java.lang.annotation.Target;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@Inherited
@Documented
Modified: 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 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,12 +21,20 @@
package org.richfaces.cdk.apt;
+import static org.junit.Assert.*;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.Name;
+import javax.lang.model.element.TypeElement;
+
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Ignore;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.cdk.CdkTestRunner;
@@ -36,14 +44,6 @@
import com.google.inject.Inject;
-import javax.lang.model.element.Modifier;
-import javax.lang.model.element.Name;
-import javax.lang.model.element.TypeElement;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
/**
* @author akolonitsky
* @since Jan 14, 2010
@@ -66,7 +66,7 @@
assertEquals(2, validators.size());
- for (ValidatorModel model: validators) {
+ for (ValidatorModel model : validators) {
String id = model.getValidatorId();
if (id != null && !id.isEmpty()) {
assertEquals("my_validator", id);
@@ -95,7 +95,7 @@
model = getValidatorModelForSetNames(true, "GeneratedClass", "BaseClass", false);
check("GeneratedClass", "BaseClass", true, model);
- ///////////////////////////////// ABSTRACT ///////////////////////////////////////
+ // /////////////////////////////// ABSTRACT ///////////////////////////////////////
// @JsfValidator public abstract class BaseClass { ...
checkAbstractWithException(null);
@@ -135,10 +135,8 @@
assertEquals(generate, model.isGenerate());
}
- private ValidatorModel getValidatorModelForSetNames(boolean isAnnotationDefined,
- String validatorClass,
- final String baseClass,
- boolean isAbstractPresent) {
+ private ValidatorModel getValidatorModelForSetNames(boolean isAnnotationDefined, String validatorClass,
+ final String baseClass, boolean isAbstractPresent) {
Name name = new MyName(baseClass);
TypeElement element = EasyMock.createMock(TypeElement.class);
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/freemarker/FreeMarkerRendererTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/freemarker/FreeMarkerRendererTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/freemarker/FreeMarkerRendererTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -13,7 +13,7 @@
@Test
public void testRender() {
-// fail("Not yet implemented");
+ // fail("Not yet implemented");
}
@Test
Deleted: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/freemarker/ValidatorTaglibGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/freemarker/ValidatorTaglibGeneratorTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/freemarker/ValidatorTaglibGeneratorTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -1,165 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright , Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.cdk.freemarker;
-
-import static org.easymock.EasyMock.*;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.net.URISyntaxException;
-import java.util.Set;
-
-import javax.faces.component.UIOutput;
-
-import org.custommonkey.xmlunit.Diff;
-import org.custommonkey.xmlunit.Validator;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.richfaces.cdk.As;
-import org.richfaces.cdk.CdkTestBase;
-import org.richfaces.cdk.CdkTestRunner;
-import org.richfaces.cdk.FileManager;
-import org.richfaces.cdk.Mock;
-import org.richfaces.cdk.OutputFolder;
-import org.richfaces.cdk.StandardOutputFolders;
-import org.richfaces.cdk.model.ClassDescription;
-import org.richfaces.cdk.model.ComponentLibrary;
-import org.richfaces.cdk.model.EventName;
-import org.richfaces.cdk.model.Property;
-import org.richfaces.cdk.model.ValidatorModel;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.ext.EntityResolver2;
-
-import com.google.inject.ImplementedBy;
-import com.google.inject.Inject;
-
-import freemarker.template.Configuration;
-import freemarker.template.ObjectWrapper;
-
-/**
- * @author akolonitsky
- * @since Jan 18, 2010
- */
-(a)RunWith(CdkTestRunner.class)
-public class ValidatorTaglibGeneratorTest extends CdkTestBase {
-
- @Inject
- private ValidatorTaglibGenerator generator;
-
- @Inject
- private ComponentLibrary library;
-
- @Inject
- @As(CdkConfiguration.class)
- private Configuration configuration;
-
- @Inject
- @As(LibraryModelWrapper.class)
- ObjectWrapper wrapper;
-
- @Mock
- private EntityResolver2 resolver;
-
- @Mock
- @OutputFolder(StandardOutputFolders.RESOURCES)
- private FileManager output;
-
- /**
- * Test method for {@link org.richfaces.cdk.generate.java.ComponentClassGenerator#getOutputFile(org.richfaces.cdk.model.ComponentModel)}.
- * @throws Exception
- */
- @Test
- public void testGetOutputFileComponent() throws Exception {
- final StringWriter outputWriter = new StringWriter();
-
-
- ValidatorModel validator = new ValidatorModel("foo.bar", new ClassDescription(UIOutput.class));
- validator.setGenerate(true);
-
- addAttribute(validator, "testValue", Object.class, true);
- addAttribute(validator, "testFlag", boolean.class, true);
- Property attribute = addAttribute(validator, "id", String.class, false);
-
- Set<EventName> eventNames = attribute.getEventNames();
- eventNames.add(getEvent("id", false));
- eventNames.add(getEvent("action", true));
-
- library.getValidators().add(validator);
- expect(output.createOutput((String) anyObject(), anyInt())).andReturn(outputWriter);
- replay(output,resolver);
- generator.visit(validator, library);
-
- System.out.println(outputWriter);
- verify(output,resolver);
-
- checkXmlStructure(outputWriter);
-
- // TODO validate xml by xsd
-// validateXml(output);
- }
-
- private EventName getEvent(String name, boolean defaultEvent) {
- EventName event = new EventName();
- event.setName(name);
- event.setDefaultEvent(defaultEvent);
- return event;
- }
-
- private Property addAttribute(ValidatorModel validator, String attributeName, Class<?> type, boolean generate) {
- Property attribute = validator.addAttribute(attributeName);
- attribute.setType(new ClassDescription(type));
- attribute.setGenerate(generate);
- return attribute;
- }
-
-
- // TODO move it in other class
- protected void validateXml(StringWriter facesConfig) throws SAXException, IOException, URISyntaxException {
- InputSource is = new InputSource(new StringReader(facesConfig.toString()));
- Validator validator = new Validator(is);
- validator.useXMLSchema(true);
- InputSource source = new InputSource(getJavaFile("META-INF/schema/web-facelettaglibrary_2_0.xsd").toURI().toString());
- validator.setJAXP12SchemaSource(source);
-
- validator.assertIsValid();
- }
-
- protected void checkXmlStructure(StringWriter writer) throws SAXException, IOException {
- Class<?> testClass = this.getClass();
- InputStream expectedFacesConfigFile = testClass.getResourceAsStream(testClass.getSimpleName() + ".xml");
- if (expectedFacesConfigFile == null) {
- return;
- }
-
- Diff xmlDiff = new Diff(
- new StringReader(writer.toString()),
- new InputStreamReader(expectedFacesConfigFile));
-
- Assert.assertTrue("XML was not similar", xmlDiff.similar());
- }
-}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -55,25 +55,22 @@
* @since Jan 20, 2010
*/
public abstract class AbstractClassGeneratorTest extends CdkTestBase {
-
+
@Inject
- protected ComponentLibrary library;
-
+ protected ComponentLibrary library;
+
@Inject
@As(CdkConfiguration.class)
protected Configuration configuration;
-
+
@Inject
@As(LibraryModelWrapper.class)
- ObjectWrapper wrapper;
+ protected ObjectWrapper wrapper;
-
@Mock
@OutputFolder(StandardOutputFolders.RESOURCES)
protected FileManager output;
-
-
protected static Property addAttribute(ModelElementBase model, String attributeName, Class<?> type, boolean generate) {
Property attribute = model.addAttribute(attributeName);
attribute.setType(new ClassDescription(type));
@@ -90,11 +87,9 @@
protected void compare(StringWriter writer, String fileName) throws IOException {
InputStream expectedFacesConfigFile = this.getClass().getResourceAsStream(fileName);
- Assert.assertNotNull("File ("+fileName+") with expected result wasn't found.", expectedFacesConfigFile);
+ Assert.assertNotNull("File (" + fileName + ") with expected result wasn't found.", expectedFacesConfigFile);
- compareTextFiles(
- new StringReader(writer.toString()),
- new InputStreamReader(expectedFacesConfigFile));
+ compareTextFiles(new StringReader(writer.toString()), new InputStreamReader(expectedFacesConfigFile));
}
protected static void compareTextFiles(Reader reference, Reader output) throws IOException {
@@ -114,8 +109,8 @@
outLine = out.readLine();
if (refLine != null && outLine != null && !refLine.trim().equals(outLine.trim())) {
- Assert.fail("Difference found on line " + ref.getLineNumber()
- + ".\nReference text is: " + refLine + "\nOutput text is: " + outLine);
+ Assert.fail("Difference found on line " + ref.getLineNumber() + ".\nReference text is: " + refLine
+ + "\nOutput text is: " + outLine);
}
}
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -46,8 +46,12 @@
@Inject
private BehaviorClassGenerator generator;
+
/**
- * Test method for {@link org.richfaces.cdk.generate.java.ComponentClassGenerator#getOutputFile(org.richfaces.cdk.model.ComponentModel)}.
+ * Test method for
+ * {@link org.richfaces.cdk.generate.java.ComponentClassGenerator#getOutputFile(org.richfaces.cdk.model.ComponentModel)}
+ * .
+ *
* @throws Exception
*/
@Test
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.generate.java;
import static org.easymock.EasyMock.*;
@@ -43,18 +41,23 @@
import com.google.inject.Inject;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@RunWith(CdkTestRunner.class)
public class ComponentClassGeneratorTest extends AbstractClassGeneratorTest {
-
+
@Inject
private ComponentClassGenerator generator;
/**
- * Test method for {@link org.richfaces.cdk.generate.java.ComponentClassGenerator#getOutputFile(org.richfaces.cdk.model.ComponentModel)}.
+ * Test method for
+ * {@link org.richfaces.cdk.generate.java.ComponentClassGenerator#getOutputFile(org.richfaces.cdk.model.ComponentModel)}
+ * .
+ *
* @throws Exception
*/
@Test
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -46,8 +46,12 @@
@Inject
private ConverterClassGenerator generator;
+
/**
- * Test method for {@link org.richfaces.cdk.generate.java.ComponentClassGenerator#getOutputFile(org.richfaces.cdk.model.ComponentModel)}.
+ * Test method for
+ * {@link org.richfaces.cdk.generate.java.ComponentClassGenerator#getOutputFile(org.richfaces.cdk.model.ComponentModel)}
+ * .
+ *
* @throws Exception
*/
@Test
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -46,8 +46,12 @@
@Inject
private ValidatorClassGenerator generator;
+
/**
- * Test method for {@link org.richfaces.cdk.generate.java.ComponentClassGenerator#getOutputFile(org.richfaces.cdk.model.ComponentModel)}.
+ * Test method for
+ * {@link org.richfaces.cdk.generate.java.ComponentClassGenerator#getOutputFile(org.richfaces.cdk.model.ComponentModel)}
+ * .
+ *
* @throws Exception
*/
@Test
Copied: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/taglib/ValidatorTaglibGeneratorTest.java (from rev 16428, root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/freemarker/ValidatorTaglibGeneratorTest.java)
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/taglib/ValidatorTaglibGeneratorTest.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/taglib/ValidatorTaglibGeneratorTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright , Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.cdk.generate.taglib;
+
+import static org.easymock.EasyMock.*;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.net.URISyntaxException;
+import java.util.Set;
+
+import javax.faces.component.UIOutput;
+
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.Validator;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.richfaces.cdk.As;
+import org.richfaces.cdk.CdkTestBase;
+import org.richfaces.cdk.CdkTestRunner;
+import org.richfaces.cdk.FileManager;
+import org.richfaces.cdk.Mock;
+import org.richfaces.cdk.OutputFolder;
+import org.richfaces.cdk.StandardOutputFolders;
+import org.richfaces.cdk.freemarker.CdkConfiguration;
+import org.richfaces.cdk.freemarker.LibraryModelWrapper;
+import org.richfaces.cdk.generate.taglib.ValidatorTaglibGenerator;
+import org.richfaces.cdk.model.ClassDescription;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.EventName;
+import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.ValidatorModel;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.ext.EntityResolver2;
+
+import com.google.inject.Inject;
+
+import freemarker.template.Configuration;
+import freemarker.template.ObjectWrapper;
+
+/**
+ * @author akolonitsky
+ * @since Jan 18, 2010
+ */
+(a)RunWith(CdkTestRunner.class)
+public class ValidatorTaglibGeneratorTest extends CdkTestBase {
+
+ @Inject
+ private ValidatorTaglibGenerator generator;
+
+ @Inject
+ private ComponentLibrary library;
+
+ @Inject
+ @As(CdkConfiguration.class)
+ private Configuration configuration;
+
+ @Inject
+ @As(LibraryModelWrapper.class)
+ ObjectWrapper wrapper;
+
+ @Mock
+ private EntityResolver2 resolver;
+
+ @Mock
+ @OutputFolder(StandardOutputFolders.RESOURCES)
+ private FileManager output;
+
+ /**
+ * Test method for
+ * {@link org.richfaces.cdk.generate.java.ComponentClassGenerator#getOutputFile(org.richfaces.cdk.model.ComponentModel)}
+ * .
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetOutputFileComponent() throws Exception {
+ final StringWriter outputWriter = new StringWriter();
+
+ ValidatorModel validator = new ValidatorModel("foo.bar", new ClassDescription(UIOutput.class));
+ validator.setGenerate(true);
+
+ addAttribute(validator, "testValue", Object.class, true);
+ addAttribute(validator, "testFlag", boolean.class, true);
+ Property attribute = addAttribute(validator, "id", String.class, false);
+
+ Set<EventName> eventNames = attribute.getEventNames();
+ eventNames.add(getEvent("id", false));
+ eventNames.add(getEvent("action", true));
+
+ library.getValidators().add(validator);
+ replay(output, resolver);
+ generator.generate(validator, outputWriter);
+
+ System.out.println(outputWriter);
+ verify(output, resolver);
+
+ checkXmlStructure(outputWriter);
+
+ // TODO validate xml by xsd
+ // validateXml(output);
+ }
+
+ private EventName getEvent(String name, boolean defaultEvent) {
+ EventName event = new EventName();
+ event.setName(name);
+ event.setDefaultEvent(defaultEvent);
+ return event;
+ }
+
+ private Property addAttribute(ValidatorModel validator, String attributeName, Class<?> type, boolean generate) {
+ Property attribute = validator.addAttribute(attributeName);
+ attribute.setType(new ClassDescription(type));
+ attribute.setGenerate(generate);
+ return attribute;
+ }
+
+ // TODO move it in other class
+ protected void validateXml(StringWriter facesConfig) throws SAXException, IOException, URISyntaxException {
+ InputSource is = new InputSource(new StringReader(facesConfig.toString()));
+ Validator validator = new Validator(is);
+ validator.useXMLSchema(true);
+ InputSource source =
+ new InputSource(getJavaFile("META-INF/schema/web-facelettaglibrary_2_0.xsd").toURI().toString());
+ validator.setJAXP12SchemaSource(source);
+
+ validator.assertIsValid();
+ }
+
+ protected void checkXmlStructure(StringWriter writer) throws SAXException, IOException {
+ Class<?> testClass = this.getClass();
+ InputStream expectedFacesConfigFile = testClass.getResourceAsStream(testClass.getSimpleName() + ".xml");
+ if (expectedFacesConfigFile == null) {
+ return;
+ }
+
+ Diff xmlDiff = new Diff(new StringReader(writer.toString()), new InputStreamReader(expectedFacesConfigFile));
+
+ Assert.assertTrue("XML was not similar", xmlDiff.similar());
+ }
+}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ClassDescriptionTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ClassDescriptionTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ClassDescriptionTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.model;
import static org.junit.Assert.*;
@@ -36,9 +34,11 @@
import org.junit.runners.Parameterized.Parameters;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@RunWith(Parameterized.class)
public class ClassDescriptionTest {
@@ -50,7 +50,7 @@
private final String simpleName;
public ClassDescriptionTest(String className, String expectedCanonicalName, String expectedBoxedName,
- String expectedTypeParameter, String packageName, String simpleName) {
+ String expectedTypeParameter, String packageName, String simpleName) {
this.className = className;
this.expectedCanonicalName = expectedCanonicalName;
this.expectedBoxedName = expectedBoxedName;
@@ -76,12 +76,9 @@
@Parameters
public static Collection<String[]> values() {
- return Arrays.asList(new String[] {
- int.class.getName(), "int", "java.lang.Integer", null, null, "int"
- }, new String[] {
- "java.util.List<String>", "java.util.List", "java.util.List<String>", "<String>", "java.util", "List"
- }, new String[] {
- double.class.getName(), "double", "java.lang.Double", null, null, "double"
- });
+ return Arrays.asList(new String[] { int.class.getName(), "int", "java.lang.Integer", null, null, "int" },
+ new String[] { "java.util.List<String>", "java.util.List", "java.util.List<String>", "<String>",
+ "java.util", "List" }, new String[] { double.class.getName(), "double", "java.lang.Double", null, null,
+ "double" });
}
}
Modified: 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-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ComponentLibraryTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.model;
import static org.junit.Assert.*;
@@ -35,14 +33,19 @@
import org.junit.Test;
/**
- * <p class="changed_added_4_0"></p>
+ * <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)}.
+ * Test method for
+ * {@link org.richfaces.cdk.model.ComponentLibrary#accept(org.richfaces.cdk.model.LibraryVisitor, java.lang.Object)}
+ * .
+ *
* @throws Exception
*/
@Test
@@ -61,7 +64,8 @@
}
/**
- * Test method for {@link org.richfaces.cdk.model.ComponentLibrary#findOrCreateRenderer(java.lang.String, java.lang.String)}.
+ * Test method for
+ * {@link org.richfaces.cdk.model.ComponentLibrary#findOrCreateRenderer(java.lang.String, java.lang.String)}.
*/
@Test
public void testFindOrCreateRenderKit() {
@@ -73,7 +77,9 @@
}
/**
- * Test method for {@link org.richfaces.cdk.model.ComponentLibrary#merge(org.richfaces.cdk.model.Mergeable, org.richfaces.cdk.model.Mergeable)}.
+ * Test method for
+ * {@link org.richfaces.cdk.model.ComponentLibrary#merge(org.richfaces.cdk.model.Mergeable, org.richfaces.cdk.model.Mergeable)}
+ * .
*/
@Test
public void testMergeTT() {
@@ -102,7 +108,10 @@
}
/**
- * Test method for {@link org.richfaces.cdk.model.ComponentLibrary#accept(java.lang.Iterable, org.richfaces.cdk.model.LibraryVisitor, java.lang.Object, java.lang.Object)}.
+ * 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
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ModelBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ModelBean.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ModelBean.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,22 +21,23 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.model;
import org.richfaces.cdk.CdkException;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@SuppressWarnings("serial")
public class ModelBean implements ModelElement<ModelBean> {
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
*/
private static final long serialVersionUID = -4853397197172488116L;
private boolean vizited = false;
@@ -46,14 +47,17 @@
private Type type;
String writeOnly;
- public ModelBean() {}
+ public ModelBean() {
+ }
public ModelBean(String name) {
this.type = new Type(name);
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the type
*/
public Type getType() {
@@ -61,15 +65,20 @@
}
/**
- * <p class="changed_added_4_0"></p>
- * @param type the type to set
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param type
+ * the type to set
*/
public void setType(Type type) {
this.type = type;
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the vizited
*/
@Merge
@@ -78,15 +87,20 @@
}
/**
- * <p class="changed_added_4_0"></p>
- * @param vizited the vizited to set
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param vizited
+ * the vizited to set
*/
public void setVizited(boolean vizited) {
this.vizited = vizited;
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the result
*/
@Merge
@@ -95,15 +109,20 @@
}
/**
- * <p class="changed_added_4_0"></p>
- * @param result the result to set
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param result
+ * the result to set
*/
public void setResult(Object result) {
this.result = result;
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the readOnly
*/
@Merge
@@ -112,15 +131,20 @@
}
/**
- * <p class="changed_added_4_0"></p>
- * @param writeOnly the writeOnly to set
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param writeOnly
+ * the writeOnly to set
*/
public void setWriteOnly(String writeOnly) {
this.writeOnly = writeOnly;
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the doNotReplace
*/
@Merge(false)
@@ -129,8 +153,11 @@
}
/**
- * <p class="changed_added_4_0"></p>
- * @param doNotReplace the doNotReplace to set
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param doNotReplace
+ * the doNotReplace to set
*/
public void setDoNotReplace(String doNotReplace) {
this.doNotReplace = doNotReplace;
@@ -147,6 +174,7 @@
return (R) visitor.visit(this, param);
}
+
@Override
public boolean same(ModelBean other) {
return null != getType() && getType().equals(other.getType());
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/NameTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/NameTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/NameTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.model;
import static org.junit.Assert.*;
@@ -32,28 +30,37 @@
import org.junit.Test;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
public class NameTest {
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @throws java.lang.Exception
*/
@Before
- public void setUp() throws Exception {}
+ public void setUp() throws Exception {
+ }
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @throws java.lang.Exception
*/
@After
- public void tearDown() throws Exception {}
+ public void tearDown() throws Exception {
+ }
/**
* Test method for {@link org.richfaces.cdk.model.Name#create(java.lang.String)}.
+ *
* @throws Exception
*/
@Test
@@ -68,6 +75,7 @@
/**
* Test method for {@link org.richfaces.cdk.model.Name#create(java.lang.String)}.
+ *
* @throws Exception
*/
@Test
@@ -82,6 +90,7 @@
/**
* Test method for {@link org.richfaces.cdk.model.Name#create(java.lang.String)}.
+ *
* @throws Exception
*/
@Test
@@ -96,6 +105,7 @@
/**
* Test method for {@link org.richfaces.cdk.model.Name#create(java.lang.String)}.
+ *
* @throws Exception
*/
@Test
@@ -110,6 +120,7 @@
/**
* Test method for {@link org.richfaces.cdk.model.Name#create(java.lang.String)}.
+ *
* @throws Exception
*/
@Test
@@ -124,6 +135,7 @@
/**
* Test method for {@link org.richfaces.cdk.model.Name#create(java.lang.String)}.
+ *
* @throws Exception
*/
@Test
@@ -138,6 +150,7 @@
/**
* Test method for {@link org.richfaces.cdk.model.Name#create(java.lang.String)}.
+ *
* @throws Exception
*/
@Test
@@ -156,15 +169,17 @@
@Test
public void testCreateStringString() {
-// fail("Not yet implemented");
+ // fail("Not yet implemented");
}
/**
- * Test method for {@link org.richfaces.cdk.model.Name#create(java.lang.String, org.richfaces.cdk.model.Name.Classifier, java.lang.String)}.
+ * Test method for
+ * {@link org.richfaces.cdk.model.Name#create(java.lang.String, org.richfaces.cdk.model.Name.Classifier, java.lang.String)}
+ * .
*/
@Test
public void testCreateStringClassifierString() {
-// fail("Not yet implemented");
+ // fail("Not yet implemented");
}
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/Bean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/Bean.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/Bean.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.parser.el.test;
import java.util.ArrayList;
@@ -29,17 +27,17 @@
import java.util.Map;
public class Bean {
- private UIComponent[] array = new UIComponent[] {new UIComponent()};
+ private UIComponent[] array = new UIComponent[] { new UIComponent() };
private List<UIComponent> components;
private Map<String, UIComponent> facets;
private Map rawMap;
private boolean readOnly;
private Bean2 testBean2;
- public Bean() {
+ public Bean() {
facets = new HashMap<String, UIComponent>();
rawMap = new HashMap();
-
+
UIComponent value = new UIComponent();
facets.put("header", value);
@@ -55,7 +53,8 @@
this.testBean2 = testBean2;
}
- public void test(UIComponent comp, boolean test) {}
+ public void test(UIComponent comp, boolean test) {
+ }
public UIComponent[] getArray() {
return array;
@@ -74,9 +73,9 @@
}
public UIComponent getFacet(String name) {
- return facets.get(name);
+ return facets.get(name);
}
-
+
public Map<String, UIComponent> getFacets() {
return facets;
}
@@ -93,7 +92,6 @@
this.rawMap = rawMap;
}
-
public boolean isReadOnly() {
return readOnly;
}
@@ -101,8 +99,8 @@
public void setReadOnly(boolean readOnly) {
this.readOnly = readOnly;
}
-
+
public Integer count(Integer i) {
- return null;
+ return null;
}
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/Bean2.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/Bean2.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/Bean2.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.parser.el.test;
public class Bean2 {
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/ELParserTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/ELParserTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/ELParserTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -19,14 +19,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.parser.el.test;
import static org.junit.Assert.*;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import java.util.HashMap;
import java.util.List;
@@ -42,45 +37,45 @@
public class ELParserTest {
- private ELVisitor visitor;
-
- @Before
- public void setUp() {
- visitor = new ELVisitor();
- }
-
- @After
- public void tearDown() {
- visitor = null;
- }
-
- @Test
+ private ELVisitor visitor;
+
+ @Before
+ public void setUp() {
+ visitor = new ELVisitor();
+ }
+
+ @After
+ public void tearDown() {
+ visitor = null;
+ }
+
+ @Test
public void testNull() throws Exception {
parseExpression("#{null}");
- assertEquals("null", visitor.getParsedExpression());
- assertTrue(visitor.getVariableType().isNullType());
+ assertEquals("null", visitor.getParsedExpression());
+ assertTrue(visitor.getVariableType().isNullType());
}
@Test
public void testTrue() throws Exception {
parseExpression("#{true}");
- assertEquals("true", visitor.getParsedExpression());
- assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
+ assertEquals("true", visitor.getParsedExpression());
+ assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
}
@Test
public void testFalse() throws Exception {
parseExpression("#{false}");
- assertEquals("false", visitor.getParsedExpression());
- assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
+ assertEquals("false", visitor.getParsedExpression());
+ assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
}
@Test
public void testFloat() throws Exception {
- parseExpression("#{5.0}");
+ parseExpression("#{5.0}");
assertEquals("Double.valueOf(5.0)", visitor.getParsedExpression());
assertEquals(Double.TYPE, visitor.getVariableType().getRawType());
-
+
parseExpression("#{5.012e+34}");
assertEquals("Double.valueOf(5.012e+34)", visitor.getParsedExpression());
assertEquals(Double.TYPE, visitor.getVariableType().getRawType());
@@ -88,28 +83,28 @@
@Test
public void testNegative() throws Exception {
- parseExpression("#{-5}");
+ parseExpression("#{-5}");
assertEquals("-5", visitor.getParsedExpression());
assertEquals(Integer.TYPE, visitor.getVariableType().getRawType());
}
@Test
public void testNegativeFloat() throws Exception {
- parseExpression("#{-5.0}");
+ parseExpression("#{-5.0}");
assertEquals("-Double.valueOf(5.0)", visitor.getParsedExpression());
assertEquals(Double.TYPE, visitor.getVariableType().getRawType());
}
@Test
public void testNotEqual() throws Exception {
- parseExpression("#{1 ne 3}");
+ parseExpression("#{1 ne 3}");
assertEquals("(1 != 3)", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
-
+
parseExpression("#{2 != 3}");
assertEquals("(2 != 3)", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
-
+
parseExpression("#{action != clientId}");
assertEquals("!isEqual(action,clientId)", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
@@ -123,8 +118,8 @@
@Test
public void testNot() throws Exception {
- parseExpression("#{not test}");
- assertEquals("(!test)", visitor.getParsedExpression());
+ parseExpression("#{not test}");
+ assertEquals("(!test)", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
parseExpression("#{!otherTest}");
@@ -134,43 +129,43 @@
@Test
public void testPlus() throws Exception {
- //TODO: tests involving double values
- parseExpression("#{1+2}");
+ // TODO: tests involving double values
+ parseExpression("#{1+2}");
assertEquals("(1 + 2)", visitor.getParsedExpression());
assertEquals(Integer.TYPE, visitor.getVariableType().getRawType());
}
@Test
public void testMinus() throws Exception {
- parseExpression("#{1-2}");
- assertEquals("(1 - 2)", visitor.getParsedExpression());
+ parseExpression("#{1-2}");
+ assertEquals("(1 - 2)", visitor.getParsedExpression());
assertEquals(Integer.TYPE, visitor.getVariableType().getRawType());
}
@Test
public void testDiv() throws Exception {
- parseExpression("#{1/2}");
+ parseExpression("#{1/2}");
assertEquals("(1 / 2)", visitor.getParsedExpression());
assertEquals(Integer.TYPE, visitor.getVariableType().getRawType());
}
@Test
public void testMult() throws Exception {
- parseExpression("#{1*2}");
+ parseExpression("#{1*2}");
assertEquals("(1 * 2)", visitor.getParsedExpression());
assertEquals(Integer.TYPE, visitor.getVariableType().getRawType());
}
@Test
public void testMod() throws Exception {
- parseExpression("#{1%2}");
- assertEquals("(1 % 2)", visitor.getParsedExpression());
+ parseExpression("#{1%2}");
+ assertEquals("(1 % 2)", visitor.getParsedExpression());
assertEquals(Integer.TYPE, visitor.getVariableType().getRawType());
}
@Test
public void testAnd() throws Exception {
- parseExpression("#{test and otherTest}");
+ parseExpression("#{test and otherTest}");
assertEquals("(test && otherTest)", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
@@ -181,10 +176,10 @@
@Test
public void testOr() throws Exception {
- parseExpression("#{test or otherTest}");
+ parseExpression("#{test or otherTest}");
assertEquals("(test || otherTest)", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
-
+
parseExpression("#{otherTest || test}");
assertEquals("(otherTest || test)", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
@@ -192,14 +187,14 @@
@Test
public void testEquals() throws Exception {
- parseExpression("#{1 eq 2}");
- assertEquals("(1 == 2)", visitor.getParsedExpression());
+ parseExpression("#{1 eq 2}");
+ assertEquals("(1 == 2)", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
-
+
parseExpression("#{3 == 2}");
assertEquals("(3 == 2)", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
-
+
parseExpression("#{action == clientId}");
assertEquals("isEqual(action,clientId)", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
@@ -213,7 +208,7 @@
@Test
public void testGreatThen() throws Exception {
- parseExpression("#{1 gt 2}");
+ parseExpression("#{1 gt 2}");
assertEquals("(1 > 2)", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
@@ -224,8 +219,8 @@
@Test
public void testLessThen() throws Exception {
- parseExpression("#{1 lt 2}");
- assertEquals("(1 < 2)", visitor.getParsedExpression());
+ parseExpression("#{1 lt 2}");
+ assertEquals("(1 < 2)", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
parseExpression("#{3 < 2}");
@@ -235,10 +230,10 @@
@Test
public void testLessThenEquals() throws Exception {
- parseExpression("#{1 le 2}");
- assertEquals("(1 <= 2)", visitor.getParsedExpression());
+ parseExpression("#{1 le 2}");
+ assertEquals("(1 <= 2)", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
-
+
parseExpression("#{3 <= 2}");
assertEquals("(3 <= 2)", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
@@ -246,8 +241,8 @@
@Test
public void testGreatThenEquals() throws Exception {
- parseExpression("#{1 ge 2}");
- assertEquals("(1 >= 2)", visitor.getParsedExpression());
+ parseExpression("#{1 ge 2}");
+ assertEquals("(1 >= 2)", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
parseExpression("#{3 >= 2}");
@@ -257,44 +252,44 @@
@Test
public void testChoice() throws Exception {
- parseExpression("#{test ? 2 : 3}");
+ parseExpression("#{test ? 2 : 3}");
assertEquals("(test ? 2 : 3)", visitor.getParsedExpression());
assertEquals(Integer.TYPE, visitor.getVariableType().getRawType());
- parseExpression("#{test ? null : 'string'}");
+ parseExpression("#{test ? null : 'string'}");
assertEquals("(test ? null : \"string\")", visitor.getParsedExpression());
assertEquals(String.class, visitor.getVariableType().getRawType());
}
@Test
public void testInteger() throws Exception {
- parseExpression("#{152}");
+ parseExpression("#{152}");
assertEquals("152", visitor.getParsedExpression());
assertEquals(Integer.TYPE, visitor.getVariableType().getRawType());
}
@Test
public void testString() throws Exception {
- parseExpression("#{\"nabc\"}");
+ parseExpression("#{\"nabc\"}");
assertEquals("\"nabc\"", visitor.getParsedExpression());
assertEquals(String.class, visitor.getVariableType().getRawType());
parseExpression("#{'nabc'}");
assertEquals("\"nabc\"", visitor.getParsedExpression());
assertEquals(String.class, visitor.getVariableType().getRawType());
-
+
parseExpression("#{'\tabc'}");
assertEquals("\"\\tabc\"", visitor.getParsedExpression());
assertEquals(String.class, visitor.getVariableType().getRawType());
-
+
parseExpression("#{'/nabc'}");
assertEquals("\"/nabc\"", visitor.getParsedExpression());
assertEquals(String.class, visitor.getVariableType().getRawType());
-
+
parseExpression("#{'na\"bc'}");
assertEquals("\"na\\\"bc\"", visitor.getParsedExpression());
assertEquals(String.class, visitor.getVariableType().getRawType());
-
+
parseExpression("#{'na\\\\bc'}");
assertEquals("\"na\\\\bc\"", visitor.getParsedExpression());
assertEquals(String.class, visitor.getVariableType().getRawType());
@@ -302,7 +297,7 @@
@Test
public void testIdentifier() throws Exception {
- parseExpression("#{clientId}");
+ parseExpression("#{clientId}");
assertEquals("clientId", visitor.getParsedExpression());
assertEquals(String.class, visitor.getVariableType().getRawType());
}
@@ -316,70 +311,69 @@
@Test
public void testMethodReturnMap() throws Exception {
- parseExpression("#{action.facets}");
+ parseExpression("#{action.facets}");
assertEquals("action.getFacets()", visitor.getParsedExpression());
Type variableType = visitor.getVariableType();
assertEquals(Map.class, variableType.getRawType());
assertEquals(UIComponent.class, variableType.getContainerType().getRawType());
-
+
parseExpression("#{action.rawMap}");
assertEquals("action.getRawMap()", visitor.getParsedExpression());
}
@Test
public void testMethodReturnMapElement() throws Exception {
- parseExpression("#{action.getFacet('header')}");
+ parseExpression("#{action.getFacet('header')}");
assertEquals("action.getFacet(\"header\")", visitor.getParsedExpression());
assertEquals(UIComponent.class, visitor.getVariableType().getRawType());
parseExpression("#{action.facets['header']}");
assertEquals("action.getFacets().get(\"header\")", visitor.getParsedExpression());
assertEquals(UIComponent.class, visitor.getVariableType().getRawType());
-
+
parseExpression("#{action.rawMap['something']}");
assertEquals("action.getRawMap().get(\"something\")", visitor.getParsedExpression());
assertEquals(Object.class, visitor.getVariableType().getRawType());
}
-// @Test
-// public void testMethodReturnMapElement1() throws Exception {
-// assertEquals("action.getFacets().get(\"header\")", resolveExpression("#{action.facets.header}"));
-// }
+ // @Test
+ // public void testMethodReturnMapElement1() throws Exception {
+ // assertEquals("action.getFacets().get(\"header\")", resolveExpression("#{action.facets.header}"));
+ // }
@Test
public void testMethodReturnMapElement2() throws Exception {
- parseExpression("#{action.facets.toString()}");
+ parseExpression("#{action.facets.toString()}");
assertEquals("action.getFacets().toString()", visitor.getParsedExpression());
assertEquals(String.class, visitor.getVariableType().getRawType());
}
-
+
@Test
public void testMethodReturnMapElement3() throws Exception {
-// assertEquals("action.getFacet(\"header\").isRendered()",
-// resolveExpression("#{action.getFacet('header').rendered}"));
- parseExpression("#{action.facets['header'].rendered}");
- assertEquals("action.getFacets().get(\"header\").isRendered()",
- visitor.getParsedExpression());
+ // assertEquals("action.getFacet(\"header\").isRendered()",
+ // resolveExpression("#{action.getFacet('header').rendered}"));
+ parseExpression("#{action.facets['header'].rendered}");
+ assertEquals("action.getFacets().get(\"header\").isRendered()", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
}
@Test
public void testMethod() throws Exception {
- parseExpression("#{action.readOnly}");
+ parseExpression("#{action.readOnly}");
assertEquals("action.isReadOnly()", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
}
@Test
public void testNestedMethod() throws Exception {
- parseExpression("#{action.testBean2.string}");
+ parseExpression("#{action.testBean2.string}");
assertEquals("action.getTestBean2().getString()", visitor.getParsedExpression());
assertEquals(String.class, visitor.getVariableType().getRawType());
}
@Test
public void testMethodReturnList() throws Exception {
- parseExpression("#{action.components}");
+ parseExpression("#{action.components}");
assertEquals("action.getComponents()", visitor.getParsedExpression());
Type variableType = visitor.getVariableType();
assertEquals(List.class, variableType.getRawType());
@@ -388,52 +382,52 @@
@Test
public void testMethodReturnListElement() throws Exception {
- parseExpression("#{action.components[0]}");
+ parseExpression("#{action.components[0]}");
assertEquals("action.getComponents().get(0)", visitor.getParsedExpression());
assertEquals(UIComponent.class, visitor.getVariableType().getRawType());
}
@Test
public void testMethodReturnListElement2() throws Exception {
- parseExpression("#{action.components[0].rendered}");
+ parseExpression("#{action.components[0].rendered}");
assertEquals("action.getComponents().get(0).isRendered()", visitor.getParsedExpression());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
}
@Test
public void testMethodReturnArray() throws Exception {
- parseExpression("#{action.array}");
+ parseExpression("#{action.array}");
assertEquals("action.getArray()", visitor.getParsedExpression());
assertEquals(UIComponent[].class, visitor.getVariableType().getRawType());
}
@Test
public void testMethodReturnArrayElement() throws Exception {
- parseExpression("#{action.array[0]}");
+ parseExpression("#{action.array[0]}");
assertEquals("action.getArray()[0]", visitor.getParsedExpression());
assertEquals(UIComponent.class, visitor.getVariableType().getRawType());
}
@Test
public void testMethodWithParam() throws Exception {
- parseExpression("#{getType(action.array[0].rendered, action.readOnly, true)}");
- assertEquals("this.getType(action.getArray()[0].isRendered(),action.isReadOnly(),true)",
- visitor.getParsedExpression());
-
+ parseExpression("#{getType(action.array[0].rendered, action.readOnly, true)}");
+ assertEquals("this.getType(action.getArray()[0].isRendered(),action.isReadOnly(),true)", visitor
+ .getParsedExpression());
+
Type variableType = visitor.getVariableType();
- parseExpression("#{action.count(123)}");
- assertEquals("action.count(123)", visitor.getParsedExpression());
- assertEquals(Integer.class, visitor.getVariableType().getRawType());
+ parseExpression("#{action.count(123)}");
+ assertEquals("action.count(123)", visitor.getParsedExpression());
+ assertEquals(Integer.class, visitor.getVariableType().getRawType());
- parseExpression("#{action.count(clientId)}");
- assertEquals("action.count(clientId)", visitor.getParsedExpression());
- assertEquals(Object.class, visitor.getVariableType().getRawType());
+ parseExpression("#{action.count(clientId)}");
+ assertEquals("action.count(clientId)", visitor.getParsedExpression());
+ assertEquals(Object.class, visitor.getVariableType().getRawType());
}
@Test
public void testEmpty() throws Exception {
- parseExpression("#{empty action.array}");
+ parseExpression("#{empty action.array}");
assertEquals("isEmpty(action.getArray())", visitor.getParsedExpression());
assertTrue(visitor.isUseEmptinessCheck());
assertEquals(Boolean.TYPE, visitor.getVariableType().getRawType());
@@ -441,14 +435,14 @@
@Test
public void testFunction() throws Exception {
- parseExpression("#{super:getType()}");
- assertEquals("super.getType()", visitor.getParsedExpression());
- Type variableType = visitor.getVariableType();
+ parseExpression("#{super:getType()}");
+ assertEquals("super.getType()", visitor.getParsedExpression());
+ Type variableType = visitor.getVariableType();
}
@Test
public void testLiteralWithDeferred() throws Exception {
- parseExpression("#{1}#{2}");
+ parseExpression("#{1}#{2}");
assertEquals("convertToString(1) + convertToString(2)", visitor.getParsedExpression());
assertEquals(String.class, visitor.getVariableType().getRawType());
@@ -459,43 +453,43 @@
@Test
public void testLiteralWithDeferred2() throws Exception {
- parseExpression("#{getType()} abs ");
+ parseExpression("#{getType()} abs ");
assertEquals("convertToString(this.getType()) + \" abs \"", visitor.getParsedExpression());
assertEquals(String.class, visitor.getVariableType().getRawType());
}
@Test
public void testThisFunction() throws Exception {
- parseExpression("#{getType()}");
+ parseExpression("#{getType()}");
assertEquals("this.getType()", visitor.getParsedExpression());
- Type variableType = visitor.getVariableType();
-
- parseExpression("#{this.getType()}");
+ Type variableType = visitor.getVariableType();
+
+ parseExpression("#{this.getType()}");
assertEquals("this.getType()", visitor.getParsedExpression());
}
@Test
public void testVariableFunction() throws Exception {
- parseExpression("#{objectVar.getType()}");
+ parseExpression("#{objectVar.getType()}");
assertEquals("objectVar.getType()", visitor.getParsedExpression());
- Type variableType = visitor.getVariableType();
+ Type variableType = visitor.getVariableType();
}
@Test
- public void testNonExistingMethod() throws Exception {
- parseExpression("#{action.doSomething(clientId, 123)}");
- assertEquals("action.doSomething(clientId,123)", visitor.getParsedExpression());
- assertEquals(Object.class, visitor.getVariableType().getRawType());
+ public void testNonExistingMethod() throws Exception {
+ parseExpression("#{action.doSomething(clientId, 123)}");
+ assertEquals("action.doSomething(clientId,123)", visitor.getParsedExpression());
+ assertEquals(Object.class, visitor.getVariableType().getRawType());
}
-
+
@Test
public void testWrongExpression() throws Exception {
try {
parseExpression("#{bean.property}");
fail("Parsing Exception is not thrown");
} catch (ParsingException pe) {
- //TODO - check message
- //ignore exception
+ // TODO - check message
+ // ignore exception
}
}
@@ -505,7 +499,7 @@
assertEquals("action.getProperty()", visitor.getParsedExpression());
assertEquals(Object.class, visitor.getVariableType().getRawType());
}
-
+
private void parseExpression(String expression) throws ParsingException {
Map<String, Type> contextMap = new HashMap<String, Type>();
@@ -516,7 +510,7 @@
contextMap.put("this", TypesFactory.getType(Object.class));
contextMap.put("super", TypesFactory.getType(Object.class));
contextMap.put("objectVar", TypesFactory.getType(Object.class));
-
+
visitor.parse(expression, contextMap);
}
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/TypesFactoryTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/TypesFactoryTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/TypesFactoryTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,13 +21,7 @@
*/
package org.richfaces.cdk.parser.el.test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
import java.io.Writer;
import java.util.List;
@@ -37,7 +31,6 @@
import org.richfaces.cdk.parser.el.Type;
import org.richfaces.cdk.parser.el.types.TypesFactory;
-
/**
* @author Nick Belaevski
*
@@ -45,17 +38,17 @@
public class TypesFactoryTest {
private static final class ParameterizedTypesHolder {
-
+
@SuppressWarnings("unused")
public Map<String, Object> getMap() {
return null;
}
-
+
@SuppressWarnings("unused")
public List<String>[] getArray() {
return null;
}
-
+
@SuppressWarnings("unused")
public List<? extends String> getWildcardList() {
return null;
@@ -66,7 +59,7 @@
return null;
}
}
-
+
private java.lang.reflect.Type getParameterizedMapType() throws Exception {
return ParameterizedTypesHolder.class.getMethod("getMap").getGenericReturnType();
}
@@ -82,14 +75,14 @@
private java.lang.reflect.Type getTypeVariableType() throws Exception {
return ParameterizedTypesHolder.class.getMethod("getTypeVariableList").getGenericReturnType();
}
-
+
@Test
public void testGetNullType() throws Exception {
Type nullType = TypesFactory.getNullType();
assertNotNull(nullType);
assertTrue(nullType.isNullType());
}
-
+
@Test
public void testGetTypeFromReflectionType() throws Exception {
Type integerType = TypesFactory.getType(Integer.TYPE);
@@ -98,7 +91,7 @@
assertNull(integerType.getTypeArguments());
assertFalse(integerType.isArray());
assertFalse(integerType.isNullType());
-
+
Type stringType = TypesFactory.getType(String.class);
assertNotNull(stringType);
assertEquals(String.class, stringType.getRawType());
@@ -112,14 +105,14 @@
assertTrue(arrayType.isArray());
assertEquals(String.class, arrayType.getContainerType().getRawType());
assertFalse(arrayType.isNullType());
-
+
Type multiDimArrayType = TypesFactory.getType(String[][][].class);
assertNotNull(multiDimArrayType);
assertNull(multiDimArrayType.getTypeArguments());
assertTrue(multiDimArrayType.isArray());
assertEquals(String[][].class, multiDimArrayType.getContainerType().getRawType());
assertFalse(multiDimArrayType.isNullType());
-
+
Type parameterizedMapType = TypesFactory.getType(getParameterizedMapType());
assertNotNull(parameterizedMapType);
assertFalse(parameterizedMapType.isArray());
@@ -130,48 +123,48 @@
assertEquals(2, parameterizedMapTypeArguments.length);
assertEquals(String.class, parameterizedMapTypeArguments[0].getRawType());
assertEquals(Object.class, parameterizedMapTypeArguments[1].getRawType());
-
+
Type parameterizedArrayType = TypesFactory.getType(getParameterizedArrayType());
assertNotNull(parameterizedArrayType);
assertTrue(parameterizedArrayType.isArray());
assertEquals(List[].class, parameterizedArrayType.getRawType());
-
+
Type[] parameterizedArrayTypeArguments = parameterizedArrayType.getTypeArguments();
assertNotNull(parameterizedArrayTypeArguments);
assertEquals(1, parameterizedArrayTypeArguments.length);
Type parameterizedArrayTypeArgument = parameterizedArrayTypeArguments[0];
assertEquals(String.class, parameterizedArrayTypeArgument.getRawType());
assertFalse(parameterizedArrayTypeArgument.isArray());
-
+
Type typeVariableType = TypesFactory.getType(getTypeVariableType());
-
+
assertNotNull(typeVariableType);
assertEquals("Abc", typeVariableType.getCode());
-
+
Type wildcardTypeHolder = TypesFactory.getType(getWildcardType());
assertNotNull(wildcardTypeHolder);
assertEquals(List.class, wildcardTypeHolder.getRawType());
-
+
Type[] wildcardTypeHolderArguments = wildcardTypeHolder.getTypeArguments();
assertNotNull(wildcardTypeHolderArguments);
assertEquals(1, wildcardTypeHolderArguments.length);
Type wildcardType = wildcardTypeHolderArguments[0];
assertEquals("? extends java.lang.String", wildcardType.getCode());
}
-
+
@Test
public void testGetTypeFromString() throws Exception {
ClassLoader classLoader = getClass().getClassLoader();
-
+
Type primitiveIntType = TypesFactory.getType("int", classLoader);
assertNotNull(primitiveIntType);
assertEquals(Integer.TYPE, primitiveIntType.getRawType());
-
+
Type guessedMapType = TypesFactory.getType("Map", classLoader);
assertNotNull(guessedMapType);
assertEquals(Map.class, guessedMapType.getRawType());
assertNull(guessedMapType.getTypeArguments());
-
+
Type writerType = TypesFactory.getType(java.io.Writer.class.getName(), classLoader);
assertNotNull(writerType);
assertEquals(Writer.class, writerType.getRawType());
@@ -179,16 +172,16 @@
Type genericMapType = TypesFactory.getType("Map<String, Object>", classLoader);
assertNotNull(genericMapType);
-
+
assertEquals(Map.class, genericMapType.getRawType());
Type[] genericMapTypeArguments = genericMapType.getTypeArguments();
assertNotNull(genericMapTypeArguments);
assertFalse(genericMapType.isArray());
assertEquals(2, genericMapTypeArguments.length);
-
+
Type genericMapTypeKeyArgument = genericMapTypeArguments[0];
assertEquals(String.class, genericMapTypeKeyArgument.getRawType());
-
+
Type genericMapTypeValueArgument = genericMapTypeArguments[1];
assertEquals(Object.class, genericMapTypeValueArgument.getRawType());
@@ -201,15 +194,15 @@
assertNotNull(genericArrayType);
assertTrue(genericArrayType.isArray());
assertEquals(List[].class, genericArrayType.getRawType());
-
+
Type[] genericArrayTypeArguments = genericArrayType.getTypeArguments();
assertNotNull(genericArrayTypeArguments);
assertEquals(1, genericArrayTypeArguments.length);
-
+
Type genericArrayTypeArgument = genericArrayTypeArguments[0];
assertEquals(String.class, genericArrayTypeArgument.getRawType());
}
-
+
@Test
public void testCaching() throws Exception {
Type objectType = TypesFactory.getType(Object.class);
@@ -217,23 +210,23 @@
assertNotNull(objectType);
assertNotNull(objectType2);
-
+
assertSame(objectType, objectType2);
-
+
TypesFactory.clearCaches();
Type objectType3 = TypesFactory.getType(Object.class);
assertNotNull(objectType3);
-
+
assertNotSame(objectType, objectType3);
}
-
+
@Test
public void testReferencedType() throws Exception {
ClassLoader classLoader = getClass().getClassLoader();
String className = "some.not.available.Class";
Type plainReferencedType = TypesFactory.getType(className, classLoader);
-
+
assertNotNull(plainReferencedType);
assertEquals(className, plainReferencedType.getCode());
@@ -242,12 +235,12 @@
assertNotNull(arrayReferencedType);
assertTrue(arrayReferencedType.isArray());
assertEquals(arraySignature, arrayReferencedType.getCode());
-
+
String genericSignature = className + "<String>";
Type genericReferenceType = TypesFactory.getType(genericSignature, classLoader);
assertNotNull(genericReferenceType);
assertEquals(genericSignature, genericReferenceType.getCode());
-
+
Type[] genericTypeArguments = genericReferenceType.getTypeArguments();
assertNotNull(genericTypeArguments);
assertEquals(1, genericTypeArguments.length);
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/UIComponent.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/UIComponent.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/parser/el/test/UIComponent.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.parser.el.test;
public class UIComponent {
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,8 +21,8 @@
*/
package org.richfaces.cdk.templatecompiler;
-import static org.junit.Assert.*;
import static org.easymock.EasyMock.*;
+import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.Collection;
@@ -60,7 +60,6 @@
import com.google.common.collect.Lists;
import com.google.inject.Inject;
-import com.google.inject.Singleton;
/**
* @author Nick Belaevski
@@ -71,14 +70,14 @@
@Inject
private RendererTemplateParser parser;
-
+
@Inject
private ComponentLibrary library;
-
+
@Inject
@As(JAXBBinding.class)
private JAXB binding;
-
+
@Mock
private EntityResolver2 resolver;
@@ -86,7 +85,6 @@
@Source(StandardSources.RENDERER_TEMPLATES)
private FileManager templatesSource;
-
private RenderKitModel getRenderkitFromModel(String renderkitId) {
Map<Id, RenderKitModel> renderKits = library.getRenderKits();
assertNotNull(renderKits);
@@ -121,11 +119,11 @@
assertNotNull(eventNames);
assertTrue(eventNames.isEmpty());
}
-
+
private void assertNoDefaultValue(Property property) {
assertNull(property.getDefaultValue());
}
-
+
private void assertNotRequired(Property property) {
assertFalse(property.isRequired());
}
@@ -223,8 +221,9 @@
assertNotNull(coolMethodProperty);
assertNoEventNames(coolMethodProperty);
- ArrayList<ClassDescription> expectedSignature = Lists.newArrayList(new ClassDescription(int.class),
- new ClassDescription(String.class), new ClassDescription(Validator.class));
+ ArrayList<ClassDescription> expectedSignature =
+ Lists.newArrayList(new ClassDescription(int.class), new ClassDescription(String.class),
+ new ClassDescription(Validator.class));
assertEquals(expectedSignature, coolMethodProperty.getSignature());
}
@@ -237,11 +236,11 @@
assertNoEventNames(integerAttribute);
assertNoSignature(integerAttribute);
assertNotRequired(integerAttribute);
-
+
assertEquals(new ClassDescription(Integer.class), integerAttribute.getType());
assertEquals("-1", integerAttribute.getDefaultValue());
}
-
+
/**
* @param property
*/
@@ -250,7 +249,7 @@
assertNoEventNames(requiredAttribute);
assertNoSignature(requiredAttribute);
assertNoDefaultValue(requiredAttribute);
-
+
assertTrue(requiredAttribute.isRequired());
assertEquals("That's a required attribute", requiredAttribute.getDescription());
assertEquals("Required Attribute", requiredAttribute.getDisplayname());
@@ -262,12 +261,10 @@
assertNoSignature(importedAttribute);
assertNoDefaultValue(importedAttribute);
assertFalse(importedAttribute.isRequired());
-
+
assertEquals(type.getName(), importedAttribute.getType().getName());
}
-
-
@Test
public void basicComponentTest() throws Exception {
Template template = parser.parseTemplate(getJavaFile("org/richfaces/cdk/templatecompiler/basic.template.xml"));
@@ -284,13 +281,14 @@
}
@Test
- @Ignore // TODO - fix import-attributes.
+ @Ignore
+ // TODO - fix import-attributes.
public void dummyComponentTest() throws Exception {
- expect(resolver.getExternalSubset(eq("cdk:root"), EasyMock.<String>anyObject())).andReturn(null).atLeastOnce();
-// expect(resolver.getExternalSubset("cdk:root", null)).andReturn(null).atLeastOnce();
- replay(resolver,templatesSource);
+ expect(resolver.getExternalSubset(eq("cdk:root"), EasyMock.<String> anyObject())).andReturn(null).atLeastOnce();
+ // expect(resolver.getExternalSubset("cdk:root", null)).andReturn(null).atLeastOnce();
+ replay(resolver, templatesSource);
Template template = parser.parseTemplate(getJavaFile("org/richfaces/cdk/templatecompiler/dummy.template.xml"));
- verify(resolver,templatesSource);
+ verify(resolver, templatesSource);
assertNotNull(template);
parser.mergeTemplateIntoModel(template);
@@ -315,12 +313,12 @@
checkDummyComponentCoolMethod(attributes.get("coolMethod"));
checkDummyComponentIntegerAttribute(attributes.get("integerAttribute"));
checkDummyComponentRequiredAttribute(attributes.get("requiredAttribute"));
-
+
checkDummyComponentImportedAttribute(attributes.get("anotherImportedStringProperty"), String.class);
checkDummyComponentImportedAttribute(attributes.get("anotherImportedProperty"), Object.class);
checkDummyComponentImportedAttribute(attributes.get("importedBooleanProperty"), boolean.class);
checkDummyComponentImportedAttribute(attributes.get("importedIntegerProperty"), Integer.class);
-
+
assertEquals(11, attributes.size());
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/XhtmlAttributesParsingTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/XhtmlAttributesParsingTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/XhtmlAttributesParsingTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,7 +21,7 @@
*/
package org.richfaces.cdk.templatecompiler;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
import java.net.URL;
import java.util.ArrayList;
@@ -147,7 +147,7 @@
Collection<Attribute> foundAttributes = findAttributesByPredicate(new AttributeNullDataPredicate());
assertTrue(foundAttributes.isEmpty());
}
-
+
@Test
public void testAttributeKinds() throws Exception {
AttributeKindPredicate booleanAttributePredicate = new AttributeKindPredicate(Kind.BOOLEAN);
@@ -168,20 +168,20 @@
+ uriAttributesNames);
for (String booleanAttributeName : booleanAttributesNames) {
- Collection<Attribute> foundAttributes = findAttributesByPredicate(new AttributeNamePredicate(
- booleanAttributeName));
+ Collection<Attribute> foundAttributes =
+ findAttributesByPredicate(new AttributeNamePredicate(booleanAttributeName));
verifyAttributesByPredicate(foundAttributes, booleanAttributePredicate);
}
for (String genericAttributeName : genericAttributesNames) {
- Collection<Attribute> foundAttributes = findAttributesByPredicate(new AttributeNamePredicate(
- genericAttributeName));
+ Collection<Attribute> foundAttributes =
+ findAttributesByPredicate(new AttributeNamePredicate(genericAttributeName));
verifyAttributesByPredicate(foundAttributes, genericAttributePredicate);
}
for (String uriAttributeName : uriAttributesNames) {
- Collection<Attribute> foundAttributes = findAttributesByPredicate(new AttributeNamePredicate(
- uriAttributeName));
+ Collection<Attribute> foundAttributes =
+ findAttributesByPredicate(new AttributeNamePredicate(uriAttributeName));
verifyAttributesByPredicate(foundAttributes, uriAttributePredicate);
}
}
@@ -195,7 +195,7 @@
return input.isRequired();
}
});
-
+
Collection<String> requiredAttributeNames = getNamesCollection(requiredAttributes);
System.out.println("XhtmlAttributesParsingTest.testRequiredAttributes(): " + requiredAttributeNames);
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -23,11 +23,7 @@
package org.richfaces.cdk.templatecompiler.model;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
import java.util.List;
@@ -45,21 +41,27 @@
private static final String TEMPLATE_EPILOG = "</cc:implementation></cdk:root>";
private static final String TEMPLATE_MIDDLE = "</cc:interface><cc:implementation>";
- public static final String TEMPLATE_PROLOG = "<cdk:root xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:cdk=\"http://richfaces.org/cdk/core\" xmlns:c=\"http://richfaces.org/cdk/jstl/core\" xmlns:cc=\"http://richfaces.org/cdk/jsf/composite\"><cc:interface>";
- private static final Object DEFAULT_ATTRIBUTE_TYPE = Object.class.getName();
+ public static final String TEMPLATE_PROLOG =
+ "<cdk:root xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:cdk=\"http://richfaces.org/cdk/core\" xmlns:c=\"http://richfaces.org/cdk/jstl/core\" xmlns:cc=\"http://richfaces.org/cdk/jsf/composite\"><cc:interface>";
+ private static final Object DEFAULT_ATTRIBUTE_TYPE = Object.class.getName();
@Test
public void testTemplate() throws Exception {
- Template template = unmarshal(Template.class, TEMPLATE_PROLOG
- + TEMPLATE_MIDDLE + TEMPLATE_EPILOG);
+ Template template = unmarshal(Template.class, TEMPLATE_PROLOG + TEMPLATE_MIDDLE + TEMPLATE_EPILOG);
assertNotNull(template.getInterface());
assertNotNull(template.getImplementation());
}
+
@Test
public void testImpl() throws Exception {
- Template template = unmarshal(Template.class, TEMPLATE_PROLOG
- + TEMPLATE_MIDDLE +"<cdk:call expression=\"#{cc.clientId}\"/><table width=\"200\"><tbody><cdk:call expression=\"#{cc.fooMethod(clientId)}\"/></tbody></table>Header<div class='bar'>foo</div>"+ TEMPLATE_EPILOG);
-
+ Template template =
+ unmarshal(
+ Template.class,
+ TEMPLATE_PROLOG
+ + TEMPLATE_MIDDLE
+ + "<cdk:call expression=\"#{cc.clientId}\"/><table width=\"200\"><tbody><cdk:call expression=\"#{cc.fooMethod(clientId)}\"/></tbody></table>Header<div class='bar'>foo</div>"
+ + TEMPLATE_EPILOG);
+
CompositeImplementation implementation = template.getImplementation();
assertNotNull(implementation);
List<Object> children = implementation.getChildren();
@@ -71,27 +73,19 @@
}
@Test
- public void testJstlCoreElements() throws Exception {
- Template template = unmarshal(Template.class, TEMPLATE_PROLOG
- + TEMPLATE_MIDDLE +
- "start" +
- "<c:if test=\"#{someTest}\">if content</c:if>" +
- "<c:choose>" +
- "<c:when test=\"#{anotherTest}\">when content</c:when>" +
- "<c:when test=\"#{coolTest}\">" +
- "<c:if test=\"#{nestedIfTest}\">nested if content</c:if>" +
- "</c:when>" +
- "<c:otherwise>otherwise content</c:otherwise>" +
- "</c:choose>" +
- "<c:forEach items=\"#{someCollection}\" var=\"iterationVar\">" +
- "forEach content" +
- "</c:forEach>" +
- "finish" +
- TEMPLATE_EPILOG);
-
+ public void testJstlCoreElements() throws Exception {
+ Template template =
+ unmarshal(Template.class, TEMPLATE_PROLOG + TEMPLATE_MIDDLE + "start"
+ + "<c:if test=\"#{someTest}\">if content</c:if>" + "<c:choose>"
+ + "<c:when test=\"#{anotherTest}\">when content</c:when>" + "<c:when test=\"#{coolTest}\">"
+ + "<c:if test=\"#{nestedIfTest}\">nested if content</c:if>" + "</c:when>"
+ + "<c:otherwise>otherwise content</c:otherwise>" + "</c:choose>"
+ + "<c:forEach items=\"#{someCollection}\" var=\"iterationVar\">" + "forEach content" + "</c:forEach>"
+ + "finish" + TEMPLATE_EPILOG);
+
CompositeImplementation implementation = template.getImplementation();
assertNotNull(implementation);
-
+
List<Object> children = implementation.getChildren();
assertNotNull(children);
assertEquals(5, children.size());
@@ -103,7 +97,7 @@
assertNotNull(ifChildren);
assertEquals(1, ifChildren.size());
assertEquals("if content", ifChildren.get(0));
-
+
assertEquals(CdkChooseElement.class, children.get(2).getClass());
CdkChooseElement chooseElement = (CdkChooseElement) children.get(2);
List<Object> chooseChildren = chooseElement.getChildren();
@@ -117,7 +111,7 @@
assertNotNull(childrenOfFirstWhen);
assertEquals(1, childrenOfFirstWhen.size());
assertEquals("when content", childrenOfFirstWhen.get(0));
-
+
assertEquals(CdkWhenElement.class, chooseChildren.get(1).getClass());
CdkWhenElement secondWhen = (CdkWhenElement) chooseChildren.get(1);
assertEquals("#{coolTest}", secondWhen.getTest());
@@ -133,14 +127,14 @@
assertNotNull(childrenOfNestedIf);
assertEquals(1, childrenOfNestedIf.size());
assertEquals("nested if content", childrenOfNestedIf.get(0));
-
+
assertEquals(CdkOtherwiseElement.class, chooseChildren.get(2).getClass());
CdkOtherwiseElement otherwiseElement = (CdkOtherwiseElement) chooseChildren.get(2);
List<Object> childrenOfOtherwiseElement = otherwiseElement.getChildren();
assertNotNull(childrenOfOtherwiseElement);
assertEquals(1, childrenOfOtherwiseElement.size());
assertEquals("otherwise content", childrenOfOtherwiseElement.get(0));
-
+
assertEquals(CdkForEachElement.class, children.get(3).getClass());
CdkForEachElement forEachElement = (CdkForEachElement) children.get(3);
assertEquals("#{someCollection}", forEachElement.getItems());
@@ -150,61 +144,62 @@
assertNotNull(forEachChildren);
assertEquals(1, forEachChildren.size());
assertEquals("forEach content", forEachChildren.get(0));
-
+
assertEquals("finish", children.get(4));
}
-
+
@Test
- public void testInterface() throws Exception {
- Template template = unmarshal(Template.class, TEMPLATE_PROLOG +
- "<cdk:class>org.richfaces.renderkit.html.TreeRenderer</cdk:class>" +
- "<cdk:superclass>org.richfaces.renderkit.TreeRendererBase</cdk:superclass>" +
- "<cdk:component-family>org.richfaces.TreeFamily</cdk:component-family>" +
- "<cdk:renderer-type>org.richfaces.TreeRenderer</cdk:renderer-type>" +
- "<cdk:renderkit-id>RF4_XHTML</cdk:renderkit-id>" +
- "<cdk:renders-children>false</cdk:renders-children>" +
- TEMPLATE_MIDDLE + TEMPLATE_EPILOG);
-
+ public void testInterface() throws Exception {
+ Template template =
+ unmarshal(Template.class, TEMPLATE_PROLOG
+ + "<cdk:class>org.richfaces.renderkit.html.TreeRenderer</cdk:class>"
+ + "<cdk:superclass>org.richfaces.renderkit.TreeRendererBase</cdk:superclass>"
+ + "<cdk:component-family>org.richfaces.TreeFamily</cdk:component-family>"
+ + "<cdk:renderer-type>org.richfaces.TreeRenderer</cdk:renderer-type>"
+ + "<cdk:renderkit-id>RF4_XHTML</cdk:renderkit-id>"
+ + "<cdk:renders-children>false</cdk:renders-children>" + TEMPLATE_MIDDLE + TEMPLATE_EPILOG);
+
CompositeInterface interfaceSection = template.getInterface();
assertNotNull(interfaceSection);
-
+
assertEquals("org.richfaces.renderkit.html.TreeRenderer", interfaceSection.getJavaClass());
assertEquals("org.richfaces.renderkit.TreeRendererBase", interfaceSection.getBaseClass());
- assertEquals("org.richfaces.TreeFamily", interfaceSection.getComponentFamily());
- assertEquals("org.richfaces.TreeRenderer", interfaceSection.getRendererType());
- assertEquals("RF4_XHTML", interfaceSection.getRenderKitId());
- assertEquals(Boolean.FALSE, interfaceSection.getRendersChildren());
-
+ assertEquals("org.richfaces.TreeFamily", interfaceSection.getComponentFamily());
+ assertEquals("org.richfaces.TreeRenderer", interfaceSection.getRendererType());
+ assertEquals("RF4_XHTML", interfaceSection.getRenderKitId());
+ assertEquals(Boolean.FALSE, interfaceSection.getRendersChildren());
+
}
@Test
- public void testAttributes() throws Exception {
- Template template = unmarshal(Template.class, TEMPLATE_PROLOG +
- "<cdk:renders-children>true</cdk:renders-children>" +
- "<cc:attribute name=\"onclick\" />" +
- "<cc:attribute name=\"mode\" default=\"ajax\" />" +
- "<cc:attribute name=\"action\" method-signature=\"void action()\" />" +
- "<cc:attribute name=\"changeListener\" method-signature=\"void changeListener(ValueChangeEvent)\" targets=\"changes changes1\" />" +
- "<cc:attribute name=\"disabled\" type=\"boolean\" />" +
- "<cc:attribute name=\"delay\" type=\"java.lang.Integer\" />" +
- "<cc:attribute name=\"id\" required=\"true\" />" +
- "<cc:attribute name=\"experts\" shortDescription=\"For use by experts\" displayName=\"Expert attribute\" expert=\"true\" />" +
- "<cc:attribute name=\"preferred\" shortDescription=\"It's a preferred attribute\" displayName=\"Preferred attribute\" preferred=\"true\" />" +
- "<cc:attribute name=\"onchange\">" +
- "<cc:clientBehavior event=\"change\" />" +
- "<cc:clientBehavior event=\"valueChange\" default=\"true\" />" +
- "</cc:attribute>" +
- TEMPLATE_MIDDLE + TEMPLATE_EPILOG);
-
+ public void testAttributes() throws Exception {
+ Template template =
+ unmarshal(
+ Template.class,
+ TEMPLATE_PROLOG
+ + "<cdk:renders-children>true</cdk:renders-children>"
+ + "<cc:attribute name=\"onclick\" />"
+ + "<cc:attribute name=\"mode\" default=\"ajax\" />"
+ + "<cc:attribute name=\"action\" method-signature=\"void action()\" />"
+ + "<cc:attribute name=\"changeListener\" method-signature=\"void changeListener(ValueChangeEvent)\" targets=\"changes changes1\" />"
+ + "<cc:attribute name=\"disabled\" type=\"boolean\" />"
+ + "<cc:attribute name=\"delay\" type=\"java.lang.Integer\" />"
+ + "<cc:attribute name=\"id\" required=\"true\" />"
+ + "<cc:attribute name=\"experts\" shortDescription=\"For use by experts\" displayName=\"Expert attribute\" expert=\"true\" />"
+ + "<cc:attribute name=\"preferred\" shortDescription=\"It's a preferred attribute\" displayName=\"Preferred attribute\" preferred=\"true\" />"
+ + "<cc:attribute name=\"onchange\">" + "<cc:clientBehavior event=\"change\" />"
+ + "<cc:clientBehavior event=\"valueChange\" default=\"true\" />" + "</cc:attribute>"
+ + TEMPLATE_MIDDLE + TEMPLATE_EPILOG);
+
CompositeInterface interfaceSection = template.getInterface();
assertNotNull(interfaceSection);
-
+
List<Attribute> attributes = interfaceSection.getAttributes();
assertNotNull(attributes);
assertEquals(10, attributes.size());
-
+
Attribute attribute;
-
+
attribute = attributes.get(0);
assertNotNull(attribute);
assertEquals("onclick", attribute.getName());
@@ -215,7 +210,7 @@
assertFalse(attribute.isRequired());
assertFalse(attribute.isExpert());
assertFalse(attribute.isPreferred());
-
+
attribute = attributes.get(1);
assertNotNull(attribute);
assertEquals("mode", attribute.getName());
@@ -294,7 +289,7 @@
assertEquals("Expert attribute", attribute.getDisplayName());
assertTrue(attribute.isExpert());
assertFalse(attribute.isPreferred());
-
+
attribute = attributes.get(8);
assertNotNull(attribute);
assertFalse(attribute.isRequired());
@@ -306,17 +301,17 @@
assertEquals("It's a preferred attribute", attribute.getShortDescription());
assertEquals("Preferred attribute", attribute.getDisplayName());
assertTrue(attribute.isPreferred());
-
+
attribute = attributes.get(9);
assertNotNull(attribute);
assertEquals("onchange", attribute.getName());
-
+
List<ClientBehavior> clientBehaviors = attribute.getClientBehaviors();
assertNotNull(clientBehaviors);
assertEquals(2, clientBehaviors.size());
-
+
ClientBehavior clientBehavior;
-
+
clientBehavior = clientBehaviors.get(0);
assertNotNull(clientBehavior);
assertEquals("change", clientBehavior.getEvent());
@@ -329,72 +324,72 @@
assertEquals(Boolean.TRUE, interfaceSection.getRendersChildren());
}
-
+
@Test
- public void testResourceDependencies() throws Exception {
- Template template = unmarshal(Template.class, TEMPLATE_PROLOG +
- "<cdk:resource-dependencies>" +
- "<cdk:resource-dependency name=\"jquery.js\" />" +
- "<cdk:resource-dependency name=\"richfaces.css\" library=\"org.richfaces\" />" +
- "<cdk:resource-dependency name=\"richfaces.js\" library=\"org.richfaces\" target=\"body\" /> " +
- "</cdk:resource-dependencies> " +
+ public void testResourceDependencies() throws Exception {
+ Template template =
+ unmarshal(Template.class, TEMPLATE_PROLOG + "<cdk:resource-dependencies>"
+ + "<cdk:resource-dependency name=\"jquery.js\" />"
+ + "<cdk:resource-dependency name=\"richfaces.css\" library=\"org.richfaces\" />"
+ + "<cdk:resource-dependency name=\"richfaces.js\" library=\"org.richfaces\" target=\"body\" /> "
+ + "</cdk:resource-dependencies> " +
- TEMPLATE_MIDDLE + TEMPLATE_EPILOG);
-
+ TEMPLATE_MIDDLE + TEMPLATE_EPILOG);
+
CompositeInterface interfaceSection = template.getInterface();
assertNotNull(interfaceSection);
-
+
assertNull(interfaceSection.getRendersChildren());
-
+
List<ResourceDependency> resourceDependencies = interfaceSection.getResourceDependencies();
- assertNotNull(resourceDependencies);
- assertEquals(3, resourceDependencies.size());
-
- ResourceDependency resourceDependency;
-
- resourceDependency = resourceDependencies.get(0);
- assertNotNull(resourceDependency);
- assertEquals("jquery.js", resourceDependency.getName());
- assertNull(resourceDependency.getLibrary());
- assertEquals("head", resourceDependency.getTarget());
+ assertNotNull(resourceDependencies);
+ assertEquals(3, resourceDependencies.size());
- resourceDependency = resourceDependencies.get(1);
- assertNotNull(resourceDependency);
- assertEquals("richfaces.css", resourceDependency.getName());
- assertEquals("org.richfaces", resourceDependency.getLibrary());
- assertEquals("head", resourceDependency.getTarget());
+ ResourceDependency resourceDependency;
- resourceDependency = resourceDependencies.get(2);
- assertNotNull(resourceDependency);
- assertEquals("richfaces.js", resourceDependency.getName());
- assertEquals("org.richfaces", resourceDependency.getLibrary());
- assertEquals("body", resourceDependency.getTarget());
- }
-
+ resourceDependency = resourceDependencies.get(0);
+ assertNotNull(resourceDependency);
+ assertEquals("jquery.js", resourceDependency.getName());
+ assertNull(resourceDependency.getLibrary());
+ assertEquals("head", resourceDependency.getTarget());
+
+ resourceDependency = resourceDependencies.get(1);
+ assertNotNull(resourceDependency);
+ assertEquals("richfaces.css", resourceDependency.getName());
+ assertEquals("org.richfaces", resourceDependency.getLibrary());
+ assertEquals("head", resourceDependency.getTarget());
+
+ resourceDependency = resourceDependencies.get(2);
+ assertNotNull(resourceDependency);
+ assertEquals("richfaces.js", resourceDependency.getName());
+ assertEquals("org.richfaces", resourceDependency.getLibrary());
+ assertEquals("body", resourceDependency.getTarget());
+ }
+
@Test
- public void testObject() throws Exception {
- Template template = unmarshal(Template.class, TEMPLATE_PROLOG + TEMPLATE_MIDDLE +
- "<cdk:object name=\"rowCount\" type=\"int\" value=\"#{getRowCount(context)}\" />" +
- "<cdk:object name=\"bodyExpression\" type=\"java.lang.String\">" +
- "\"test expression\" +\n\"second line\"" +
- "</cdk:object>" +
+ public void testObject() throws Exception {
+ Template template =
+ unmarshal(Template.class, TEMPLATE_PROLOG + TEMPLATE_MIDDLE
+ + "<cdk:object name=\"rowCount\" type=\"int\" value=\"#{getRowCount(context)}\" />"
+ + "<cdk:object name=\"bodyExpression\" type=\"java.lang.String\">"
+ + "\"test expression\" +\n\"second line\"" + "</cdk:object>" +
- TEMPLATE_EPILOG);
-
+ TEMPLATE_EPILOG);
+
CompositeImplementation implementation = template.getImplementation();
assertNotNull(implementation);
-
+
List<Object> children = implementation.getChildren();
assertNotNull(children);
assertEquals(2, children.size());
-
+
assertEquals(CdkObjectElement.class, children.get(0).getClass());
CdkObjectElement firstObject = (CdkObjectElement) children.get(0);
assertNotNull(firstObject);
assertEquals("rowCount", firstObject.getName());
assertEquals("int", firstObject.getType());
assertEquals("#{getRowCount(context)}", firstObject.getValue());
-
+
assertEquals(CdkObjectElement.class, children.get(1).getClass());
CdkObjectElement secondObject = (CdkObjectElement) children.get(1);
assertNotNull(secondObject);
@@ -403,5 +398,3 @@
assertEquals("\"test expression\" +\n\"second line\"", secondObject.getBodyValue());
}
}
-
-
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/CdkResolverTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/CdkResolverTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/CdkResolverTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -1,9 +1,8 @@
package org.richfaces.cdk.xmlconfig;
+import static org.easymock.EasyMock.*;
import static org.junit.Assert.*;
-import static org.easymock.EasyMock.*;
-
import java.io.ByteArrayInputStream;
import java.io.InputStream;
@@ -25,16 +24,16 @@
@RunWith(CdkTestRunner.class)
public class CdkResolverTest extends CdkTestBase {
-
+
private static final String TEST_HTML = "org/richfaces/cdk/apt/test.html";
@Inject
private CdkEntityResolver entityResolver;
-
+
@Mock
@Source(StandardSources.FACES_CONFIGS)
private FileManager facesConfigSource;
-
+
@Mock
@Source(StandardSources.RENDERER_TEMPLATES)
private FileManager templatesSource;
@@ -43,59 +42,58 @@
public void configure(Binder binder) {
super.configure(binder);
try {
- CdkClassLoader classLoader = new CdkClassLoader(ImmutableList.of(getLibraryFile("test.source.properties"),getLibraryFile(Component.class)), null){
- @Override
- public InputStream getResourceAsStream(String name) {
- if ("foo/bar.xml".equals(name)) {
- return new ByteArrayInputStream("baz".getBytes());
- } else {
- return super.getResourceAsStream(name);
+ CdkClassLoader classLoader =
+ new CdkClassLoader(ImmutableList.of(getLibraryFile("test.source.properties"),
+ getLibraryFile(Component.class)), null) {
+ @Override
+ public InputStream getResourceAsStream(String name) {
+ if ("foo/bar.xml".equals(name)) {
+ return new ByteArrayInputStream("baz".getBytes());
+ } else {
+ return super.getResourceAsStream(name);
+ }
}
- }
- };
+ };
binder.bind(CdkClassLoader.class).toInstance(classLoader);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
-
+
@Test
public void testResolveSystemIdSystem() throws Exception {
- replay(facesConfigSource,templatesSource);
+ replay(facesConfigSource, templatesSource);
InputSource input = entityResolver.resolveSystemId("http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd");
- verify(facesConfigSource,templatesSource);
+ verify(facesConfigSource, templatesSource);
assertNotNull(input);
}
@Test
public void testResolveSystemIdResource() throws Exception {
- replay(facesConfigSource,templatesSource);
+ replay(facesConfigSource, templatesSource);
InputSource input = entityResolver.resolveSystemId("urn:resource:foo/bar.xml");
- verify(facesConfigSource,templatesSource);
+ verify(facesConfigSource, templatesSource);
assertNotNull(input);
}
@Test
public void testResolveSystemIdAttributes() throws Exception {
-
- replay(facesConfigSource,templatesSource);
+ replay(facesConfigSource, templatesSource);
InputSource input = entityResolver.resolveSystemId("urn:attributes:test-props.xml");
- verify(facesConfigSource,templatesSource);
+ verify(facesConfigSource, templatesSource);
assertNotNull(input);
}
-
@Test
public void testGetProjectInputSource() throws Exception {
expect(facesConfigSource.getFile(TEST_HTML)).andReturn(getJavaFile(TEST_HTML));
- replay(facesConfigSource,templatesSource);
- InputSource input = entityResolver.getProjectInputSource(facesConfigSource,
- TEST_HTML);
- verify(facesConfigSource,templatesSource);
+ replay(facesConfigSource, templatesSource);
+ InputSource input = entityResolver.getProjectInputSource(facesConfigSource, TEST_HTML);
+ verify(facesConfigSource, templatesSource);
assertNotNull(input);
}
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -63,7 +63,7 @@
@Inject
FragmentParser parser;
-
+
@Inject
@As(CdkEntityResolver.class)
EntityResolver2 resolver;
@@ -71,7 +71,7 @@
@Inject
@As(JAXBBinding.class)
JAXB jaxbBinding;
-
+
@Mock
@Source(StandardSources.RENDERER_TEMPLATES)
private FileManager templatesSource;
@@ -88,8 +88,9 @@
@Test
public void testComponentUnmarshal() throws Exception {
- FacesConfigBean library = jaxbBinding.unmarshal("urn:resource:org/richfaces/cdk/xmlconfig/component.xml",
- ComponentLibrary.FACES_CONFIG_SCHEMA_LOCATION, FacesConfigBean.class);
+ FacesConfigBean library =
+ jaxbBinding.unmarshal("urn:resource:org/richfaces/cdk/xmlconfig/component.xml",
+ ComponentLibrary.FACES_CONFIG_SCHEMA_LOCATION, FacesConfigBean.class);
assertEquals(1, library.getComponents().size());
@@ -118,8 +119,9 @@
@Test
public void testRenderKitUnmarshall() throws Exception {
- FacesConfigBean library = jaxbBinding.unmarshal("urn:resource:org/richfaces/cdk/xmlconfig/renderkit.xml",
- ComponentLibrary.FACES_CONFIG_SCHEMA_LOCATION, FacesConfigBean.class);
+ FacesConfigBean library =
+ jaxbBinding.unmarshal("urn:resource:org/richfaces/cdk/xmlconfig/renderkit.xml",
+ ComponentLibrary.FACES_CONFIG_SCHEMA_LOCATION, FacesConfigBean.class);
List<RenderKitBean> renderKits = library.getRenderKits();
assertEquals(2, renderKits.size());
assertEquals(new RenderKitModel.Id("HTML_BASIC"), renderKits.get(0).getKey());
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.xmlconfig;
import static org.junit.Assert.*;
@@ -49,16 +47,18 @@
import com.google.inject.Inject;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@RunWith(CdkTestRunner.class)
public class FragmentParserTest extends CdkTestBase {
-
+
@Inject
FragmentParser parser;
-
+
@Inject
@As(CdkEntityResolver.class)
EntityResolver2 resolver;
@@ -66,7 +66,7 @@
@Inject
@As(JAXBBinding.class)
JAXB binder;
-
+
@Mock
@Source(StandardSources.RENDERER_TEMPLATES)
private FileManager templatesSource;
@@ -80,7 +80,7 @@
super.configure(binder);
binder.bind(CdkClassLoader.class).toInstance(createClassLoader());
}
-
+
@Test
public void parserTest() throws Exception {
@@ -93,7 +93,8 @@
@Test
public void xincludeTest() throws Exception {
- Map<String, Property> properties = parser.parseProperties("urn:resource:org/richfaces/cdk/xmlconfig/parent.xml");
+ Map<String, Property> properties =
+ parser.parseProperties("urn:resource:org/richfaces/cdk/xmlconfig/parent.xml");
assertEquals(2, properties.size());
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JAXBCopyTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JAXBCopyTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JAXBCopyTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -5,7 +5,6 @@
import java.util.List;
import org.junit.Test;
-
import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.xmlconfig.model.ComponentBean;
@@ -35,7 +34,7 @@
List<PropertyBase> attributes = componentBean.getAttributes();
assertEquals(0, attributes.size());
-// assertEquals(BAZ, attributes.get(0).getKey().toString());
+ // assertEquals(BAZ, attributes.get(0).getKey().toString());
ComponentExtension extension = componentBean.getExtension();
@@ -46,12 +45,12 @@
@Test
public void testCopyExtensions() {
-// fail("Not yet implemented");
+ // fail("Not yet implemented");
}
@Test
public void testCopyProperties() {
-// fail("Not yet implemented");
+ // fail("Not yet implemented");
}
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbMarshalTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbMarshalTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbMarshalTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -18,16 +18,16 @@
@RunWith(CdkTestRunner.class)
public class JaxbMarshalTest extends JaxbTestBase {
-
+
@Mock
JAXB jaxbBinding;
-
+
@Inject
ComponentLibrary library;
-
+
@Test
public void testMarshalResultStringT() throws Exception {
- 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/JaxbTestBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbTestBase.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbTestBase.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -1,11 +1,12 @@
package org.richfaces.cdk.xmlconfig;
-import org.richfaces.cdk.CdkTestBase;
-
-import javax.xml.bind.JAXB;
import java.io.ByteArrayOutputStream;
import java.io.StringReader;
+import javax.xml.bind.JAXB;
+
+import org.richfaces.cdk.CdkTestBase;
+
public abstract class JaxbTestBase extends CdkTestBase {
protected static final String XML_PROLOG = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbUnmarshalTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbUnmarshalTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbUnmarshalTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,33 +21,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.xmlconfig;
-import static org.easymock.EasyMock.*;
-
import static org.junit.Assert.*;
-import static javax.lang.model.util.ElementFilter.*;
-
-import java.io.StringReader;
-
import java.util.Set;
-import javax.xml.bind.JAXB;
-
import org.junit.Test;
-
import org.richfaces.cdk.xmlconfig.testmodel.Child;
import org.richfaces.cdk.xmlconfig.testmodel.Root;
/**
* <p class="changed_added_4_0">
* </p>
- *
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
public class JaxbUnmarshalTest extends JaxbTestBase {
@Test
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -22,13 +22,13 @@
package org.richfaces.cdk.xmlconfig.testmodel;
+import java.io.StringWriter;
+
import org.junit.Test;
import org.richfaces.cdk.model.BehaviorModel;
import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.ComponentLibrary;
-import java.io.StringWriter;
-
/**
* @author akolonitsky
* @since Jan 21, 2010
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/Child.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/Child.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/Child.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,26 +21,24 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.xmlconfig.testmodel;
-import org.w3c.dom.Element;
-
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;
+import org.w3c.dom.Element;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@XmlType(name = "ChildType", namespace = Root.HTTP_FOO_BAR_SCHEMA)
public class Child implements Id {
@@ -50,7 +48,8 @@
private String wrapped;
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.xmlconfig.testmodel.Id#getId()
*/
@Override
@@ -60,15 +59,20 @@
}
/**
- * <p class="changed_added_4_0"></p>
- * @param id the id to set
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param id
+ * the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the value
*/
@XmlElement(namespace = Root.HTTP_FOO_BAR_SCHEMA)
@@ -77,8 +81,11 @@
}
/**
- * <p class="changed_added_4_0"></p>
- * @param value the value to set
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param value
+ * the value to set
*/
public void setValue(String value) {
this.value = value;
@@ -98,7 +105,9 @@
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the wrapped
*/
public String getWrapped() {
@@ -106,15 +115,19 @@
}
/**
- * <p class="changed_added_4_0"></p>
- * @param wrapped the wrapped to set
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param wrapped
+ * the wrapped to set
*/
public void setWrapped(String wrapped) {
this.wrapped = wrapped;
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see java.lang.Object#hashCode()
*/
@Override
@@ -128,7 +141,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
@@ -159,16 +173,20 @@
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
public static class Extension {
private List<Element> extensions = new ArrayList<Element>();
private Child parent;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the myExtension
*/
@XmlElement(namespace = Root.EXTENSIONS_NAMESPACE)
@@ -177,15 +195,20 @@
}
/**
- * <p class="changed_added_4_0"></p>
- * @param myExtension the myExtension to set
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param myExtension
+ * the myExtension to set
*/
public void setMyExtension(String myExtension) {
parent.setWrapped(myExtension);
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the extensions
*/
@XmlAnyElement
@@ -194,8 +217,11 @@
}
/**
- * <p class="changed_added_4_0"></p>
- * @param extensions the extensions to set
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param extensions
+ * the extensions to set
*/
public void setExtensions(List<Element> extensions) {
this.extensions = extensions;
@@ -209,6 +235,7 @@
// This method is called after all the properties (except IDREF) are unmarshalled for this object,
// but before this object is set to the parent object.
- void afterUnmarshal(Unmarshaller u, Object parent) {}
+ void afterUnmarshal(Unmarshaller u, Object parent) {
+ }
}
}
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-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,16 +21,13 @@
package org.richfaces.cdk.xmlconfig.testmodel;
+import java.io.StringWriter;
+
import org.junit.Test;
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 java.io.StringWriter;
-
/**
* @author akolonitsky
* @since Jan 10, 2010
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/Id.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/Id.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/Id.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -5,7 +5,9 @@
public interface Id {
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the id
*/
@XmlElement(namespace = Root.HTTP_FOO_BAR_SCHEMA)
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-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ModelBeanTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -65,12 +65,11 @@
@Inject
@As(JAXBBinding.class)
JAXB binding;
-
+
@Inject
@As(CdkEntityResolver.class)
EntityResolver2 resolver;
-
@Mock
@Source(StandardSources.RENDERER_TEMPLATES)
FileManager templatesSource;
@@ -101,11 +100,9 @@
if (expectedFacesConfigFile == null) {
return;
}
-
- Diff xmlDiff = new Diff(
- new StringReader(writer.toString()),
- new InputStreamReader(expectedFacesConfigFile));
+ Diff xmlDiff = new Diff(new StringReader(writer.toString()), new InputStreamReader(expectedFacesConfigFile));
+
Assert.assertTrue("XML was not similar", xmlDiff.similar());
}
@@ -113,8 +110,7 @@
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
- binding.marshal(result, FacesConfigGenerator.FACES_SCHEMA_LOCATION,
- new FacesConfigAdapter().marshal(library));
+ binding.marshal(result, FacesConfigGenerator.FACES_SCHEMA_LOCATION, new FacesConfigAdapter().marshal(library));
return writer;
}
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/Root.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/Root.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/Root.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.xmlconfig.testmodel;
import java.util.Set;
@@ -33,9 +31,11 @@
import com.google.common.collect.Sets;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@XmlRootElement(name = "root-config", namespace = Root.HTTP_FOO_BAR_SCHEMA)
public class Root {
@@ -45,7 +45,9 @@
private String name;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the name
*/
@XmlElement(namespace = HTTP_FOO_BAR_SCHEMA)
@@ -54,15 +56,20 @@
}
/**
- * <p class="changed_added_4_0"></p>
- * @param name the name to set
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param name
+ * the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the children
*/
@XmlElement(namespace = HTTP_FOO_BAR_SCHEMA)
@@ -71,8 +78,11 @@
}
/**
- * <p class="changed_added_4_0"></p>
- * @param children the children to set
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param children
+ * the children to set
*/
public void setChildren(Set<Child> children) {
this.children = children;
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -21,13 +21,13 @@
package org.richfaces.cdk.xmlconfig.testmodel;
+import java.io.StringWriter;
+
import org.junit.Test;
import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ValidatorModel;
-import java.io.StringWriter;
-
/**
* @author akolonitsky
* @since Jan 13, 2010
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/package-info.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/package-info.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/package-info.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -13,12 +13,11 @@
*
*/
@XmlAccessorType(XmlAccessType.NONE)
-(a)javax.xml.bind.annotation.XmlSchema(namespace=Root.HTTP_FOO_BAR_SCHEMA ,
- xmlns = {(a)javax.xml.bind.annotation.XmlNs( prefix = "",
- namespaceURI = Root.HTTP_FOO_BAR_SCHEMA ),
- @javax.xml.bind.annotation.XmlNs( prefix = "ext",
- namespaceURI = Root.EXTENSIONS_NAMESPACE ) })
+(a)javax.xml.bind.annotation.XmlSchema(namespace = Root.HTTP_FOO_BAR_SCHEMA, xmlns = {
+ @javax.xml.bind.annotation.XmlNs(prefix = "", namespaceURI = Root.HTTP_FOO_BAR_SCHEMA),
+ @javax.xml.bind.annotation.XmlNs(prefix = "ext", namespaceURI = Root.EXTENSIONS_NAMESPACE) })
package org.richfaces.cdk.xmlconfig.testmodel;
-import javax.xml.bind.annotation.XmlAccessorType;
+
import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodyMergeTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodyMergeTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodyMergeTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -19,20 +19,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.xmlutils;
import junit.framework.TestCase;
/**
* @author Maksim Kaszynski
- *
+ *
*/
public class XMLBodyMergeTest extends TestCase {
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
@@ -40,7 +39,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see junit.framework.TestCase#tearDown()
*/
protected void tearDown() throws Exception {
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodySerializerTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodySerializerTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodySerializerTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.xmlutils;
import java.io.ByteArrayInputStream;
@@ -33,13 +31,14 @@
/**
* @author Maksim Kaszynski
- *
+ *
*/
public class XMLBodySerializerTest extends TestCase {
private XMLBodySerializer serializer;
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
@@ -48,7 +47,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see junit.framework.TestCase#tearDown()
*/
protected void tearDown() throws Exception {
@@ -57,16 +57,17 @@
}
/**
- * Test method for {@link org.richfaces.cdk.xmlutils.XMLBodySerializer#serialize(org.w3c.dom.NodeList, org.w3c.dom.Document)}.
+ * Test method for
+ * {@link org.richfaces.cdk.xmlutils.XMLBodySerializer#serialize(org.w3c.dom.NodeList, org.w3c.dom.Document)}.
*/
public void testSerialize() throws ParsingException {
String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- + "<!DOCTYPE faces-config PUBLIC \"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN\"\n"
- + " \"http://java.sun.com/dtd/web-facesconfig_1_1.dtd\">\n"
- + "<faces-config>\n"
- + " <component><test>blabla</test></component><component><test>blabla</test></component><component><test>blabla2</test></component>\n"
- + "</faces-config>";
+ + "<!DOCTYPE faces-config PUBLIC \"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN\"\n"
+ + " \"http://java.sun.com/dtd/web-facesconfig_1_1.dtd\">\n"
+ + "<faces-config>\n"
+ + " <component><test>blabla</test></component><component><test>blabla</test></component><component><test>blabla2</test></component>\n"
+ + "</faces-config>";
InputStream in = new ByteArrayInputStream(xml.getBytes());
XMLBody body = new XMLBody();
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodyTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodyTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodyTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -19,26 +19,23 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.xmlutils;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-
import java.util.HashSet;
import junit.framework.TestCase;
/**
* @author shura
- *
+ *
*/
public class XMLBodyTest extends TestCase {
/*
* (non-Javadoc)
- *
+ *
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
@@ -47,7 +44,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see junit.framework.TestCase#tearDown()
*/
protected void tearDown() throws Exception {
@@ -55,21 +52,22 @@
}
/**
- * Test method for
- * {@link org.richfaces.cdk.xmlutils.XMLBody#loadXML(java.io.InputStream)}.
- *
+ * Test method for {@link org.richfaces.cdk.xmlutils.XMLBody#loadXML(java.io.InputStream)}.
+ *
* @throws ParsingException
*/
public void testLoadXML() throws ParsingException {
String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- + "<!DOCTYPE faces-config PUBLIC \"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN\"\n"
- + " \"http://java.sun.com/dtd/web-facesconfig_1_1.dtd\">\n"
- + "<faces-config>\n" + " <component>\n" + " <component-type>org.richfaces.ajax.Test</component-type>\n"
- + " <component-class>org.richfaces.ajax.html.Test</component-class>\n" + "\n"
- + " <component-extension>\n" + " <component-family>org.richfaces.Test</component-family>\n"
- + " <renderer-type>org.richfaces.Test</renderer-type>\n" + " </component-extension>\n"
- + " </component>\n" + "</faces-config>";
+ + "<!DOCTYPE faces-config PUBLIC \"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN\"\n"
+ + " \"http://java.sun.com/dtd/web-facesconfig_1_1.dtd\">\n"
+ + "<faces-config>\n" + " <component>\n"
+ + " <component-type>org.richfaces.ajax.Test</component-type>\n"
+ + " <component-class>org.richfaces.ajax.html.Test</component-class>\n" + "\n"
+ + " <component-extension>\n"
+ + " <component-family>org.richfaces.Test</component-family>\n"
+ + " <renderer-type>org.richfaces.Test</renderer-type>\n" + " </component-extension>\n"
+ + " </component>\n" + "</faces-config>";
InputStream in = new ByteArrayInputStream(xml.getBytes());
XMLBody body = new XMLBody();
@@ -77,17 +75,16 @@
}
/**
- * Test method for
- * {@link org.richfaces.cdk.xmlutils.XMLBody#isRootName(java.lang.String)}.
- *
+ * Test method for {@link org.richfaces.cdk.xmlutils.XMLBody#isRootName(java.lang.String)}.
+ *
* @throws ParsingException
*/
public void testIsRootName() throws ParsingException {
String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- + "<!DOCTYPE faces-config PUBLIC \"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN\"\n"
- + " \"http://java.sun.com/dtd/web-facesconfig_1_1.dtd\">\n"
- + "<faces-config>\n" + " <component>\n" + " </component>\n" + "</faces-config>";
+ + "<!DOCTYPE faces-config PUBLIC \"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN\"\n"
+ + " \"http://java.sun.com/dtd/web-facesconfig_1_1.dtd\">\n"
+ + "<faces-config>\n" + " <component>\n" + " </component>\n" + "</faces-config>";
InputStream in = new ByteArrayInputStream(xml.getBytes());
XMLBody body = new XMLBody();
@@ -98,15 +95,15 @@
/**
* Test method for {@link org.richfaces.cdk.xmlutils.XMLBody#getDoctype()}.
- *
+ *
* @throws ParsingException
*/
public void testGetDoctype() throws ParsingException {
String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- + "<!DOCTYPE faces-config PUBLIC \"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN\"\n"
- + " \"http://java.sun.com/dtd/web-facesconfig_1_1.dtd\">\n"
- + "<faces-config>\n" + " <component>\n" + " </component>\n" + "</faces-config>";
+ + "<!DOCTYPE faces-config PUBLIC \"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN\"\n"
+ + " \"http://java.sun.com/dtd/web-facesconfig_1_1.dtd\">\n"
+ + "<faces-config>\n" + " <component>\n" + " </component>\n" + "</faces-config>";
InputStream in = new ByteArrayInputStream(xml.getBytes());
XMLBody body = new XMLBody();
@@ -115,16 +112,15 @@
}
/**
- * Test method for
- * {@link org.richfaces.cdk.xmlutils.XMLBody#getRootNameSpace()}.
- *
+ * Test method for {@link org.richfaces.cdk.xmlutils.XMLBody#getRootNameSpace()}.
+ *
* @throws ParsingException
*/
public void testGetRootNameSpace() throws ParsingException {
String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n"
- + " <modelVersion>4.0.0</modelVersion>\n" + "</project>";
+ + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n"
+ + " <modelVersion>4.0.0</modelVersion>\n" + "</project>";
InputStream in = new ByteArrayInputStream(xml.getBytes());
XMLBody body = new XMLBody();
@@ -134,14 +130,14 @@
/**
* Test method for {@link org.richfaces.cdk.xmlutils.XMLBody#getContent()}.
- *
+ *
* @throws ParsingException
*/
public void testGetContent() throws ParsingException {
String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">"
- + "<modelVersion>4.0.0</modelVersion></project>";
+ + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">"
+ + "<modelVersion>4.0.0</modelVersion></project>";
InputStream in = new ByteArrayInputStream(xml.getBytes());
XMLBody body = new XMLBody();
@@ -152,9 +148,9 @@
public void testGetContentXpath() throws ParsingException {
String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- + "<!DOCTYPE faces-config PUBLIC \"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN\"\n"
- + " \"http://java.sun.com/dtd/web-facesconfig_1_1.dtd\">\n"
- + "<faces-config>\n" + " <component>blabla</component>\n" + "</faces-config>";
+ + "<!DOCTYPE faces-config PUBLIC \"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN\"\n"
+ + " \"http://java.sun.com/dtd/web-facesconfig_1_1.dtd\">\n"
+ + "<faces-config>\n" + " <component>blabla</component>\n" + "</faces-config>";
InputStream in = new ByteArrayInputStream(xml.getBytes());
XMLBody body = new XMLBody();
@@ -171,11 +167,11 @@
public void testGetContentUnique() throws ParsingException {
String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- + "<!DOCTYPE faces-config PUBLIC \"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN\"\n"
- + " \"http://java.sun.com/dtd/web-facesconfig_1_1.dtd\">\n"
- + "<faces-config>\n"
- + " <component><test>blabla</test></component><component><test>blabla</test></component><component><test>blabla2</test></component>\n"
- + "</faces-config>";
+ + "<!DOCTYPE faces-config PUBLIC \"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN\"\n"
+ + " \"http://java.sun.com/dtd/web-facesconfig_1_1.dtd\">\n"
+ + "<faces-config>\n"
+ + " <component><test>blabla</test></component><component><test>blabla</test></component><component><test>blabla2</test></component>\n"
+ + "</faces-config>";
InputStream in = new ByteArrayInputStream(xml.getBytes());
XMLBody body = new XMLBody();
@@ -183,8 +179,9 @@
try {
String expected = "<component><test>blabla</test></component><component><test>blabla2</test></component>";
- String actual = body.getContentUnique("/faces-config/component", "test/text()",
- new HashSet<String>()).replaceAll("\\s", "");
+ String actual =
+ body.getContentUnique("/faces-config/component", "test/text()", new HashSet<String>()).replaceAll(
+ "\\s", "");
assertEquals(expected, actual);
} catch (ParsingException e) {
@@ -194,9 +191,10 @@
}
public void testGetContentWithNS() throws Exception {
- String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- + "<f:faces-config xmlns=\"http://foo.bar\" xmlns:f=\"http://foo.baz\">"
- + "<f:component><test f:foo=\"xxx\">blabla</test></f:component>" + "</f:faces-config>";
+ String xml =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ + "<f:faces-config xmlns=\"http://foo.bar\" xmlns:f=\"http://foo.baz\">"
+ + "<f:component><test f:foo=\"xxx\">blabla</test></f:component>" + "</f:faces-config>";
InputStream in = new ByteArrayInputStream(xml.getBytes());
XMLBody body = new XMLBody();
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XPathComparatorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XPathComparatorTest.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XPathComparatorTest.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.xmlutils;
import java.io.ByteArrayInputStream;
@@ -33,12 +31,13 @@
/**
* @author Maksim Kaszynski
- *
+ *
*/
public class XPathComparatorTest extends TestCase {
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
@@ -46,7 +45,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see junit.framework.TestCase#tearDown()
*/
protected void tearDown() throws Exception {
@@ -54,9 +54,10 @@
}
public void testCompare() throws Exception {
- String xml = "<faces-config>" + "<component><test>blabla1</test></component>"
- + "<component><test>blabla</test></component>" + "<renderer><foo>blabla2</foo></renderer>"
- + "<component><test>blabla2</test></component>" + "</faces-config>";
+ String xml =
+ "<faces-config>" + "<component><test>blabla1</test></component>"
+ + "<component><test>blabla</test></component>" + "<renderer><foo>blabla2</foo></renderer>"
+ + "<component><test>blabla2</test></component>" + "</faces-config>";
InputStream in = new ByteArrayInputStream(xml.getBytes());
XMLBody body = new XMLBody();
Modified: root/cdk/trunk/plugins/generator/src/test/java/test/TestComponent.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/test/TestComponent.java 2010-02-08 20:30:00 UTC (rev 16428)
+++ root/cdk/trunk/plugins/generator/src/test/java/test/TestComponent.java 2010-02-09 00:40:51 UTC (rev 16429)
@@ -19,20 +19,18 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package test;
import javax.faces.component.UIInput;
/**
- *
+ *
* @author shura (latest modification by $Author$)
- *
+ *
* @version $Revision$ $Date$
- *
- *
- *
+ *
+ *
+ *
*/
public abstract class TestComponent extends UIInput {
public abstract String getMyProperty();
15 years, 7 months
JBoss Rich Faces SVN: r16428 - in branches/community/3.3.X/ui/drag-drop/src/main: java/org/richfaces/renderkit/html and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-02-08 15:30:00 -0500 (Mon, 08 Feb 2010)
New Revision: 16428
Added:
branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/html/DnDParamRenderer.java
Modified:
branches/community/3.3.X/ui/drag-drop/src/main/config/component/dndParam.xml
Log:
Fix https://jira.jboss.org/jira/browse/RF-8347
Modified: branches/community/3.3.X/ui/drag-drop/src/main/config/component/dndParam.xml
===================================================================
--- branches/community/3.3.X/ui/drag-drop/src/main/config/component/dndParam.xml 2010-02-08 15:36:56 UTC (rev 16427)
+++ branches/community/3.3.X/ui/drag-drop/src/main/config/component/dndParam.xml 2010-02-08 20:30:00 UTC (rev 16428)
@@ -12,10 +12,20 @@
<classname>org.richfaces.component.html.HtmlDndParamComponentTest</classname>
<superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
</test>
+
<description>
<![CDATA[A component is used for parameters transmission in Drag and Drop operations. It's also used for dragIndicator elements definition with transmitting some values for rendering in it.
]]>
</description>
+ <renderer generate="false" override="false">
+ <name>org.richfaces.DnDParamRenderer</name>
+ <classname>
+ org.richfaces.renderkit.html.DnDParamRenderer
+ </classname>
+ <description>test renderer description</description>
+ <displayname>renderer for DND param</displayname>
+ <icon>icon</icon>
+ </renderer>
<!-- renderer generate="false" override="true">
</renderer -->
<tag>
Added: branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/html/DnDParamRenderer.java
===================================================================
--- branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/html/DnDParamRenderer.java (rev 0)
+++ branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/html/DnDParamRenderer.java 2010-02-08 20:30:00 UTC (rev 16428)
@@ -0,0 +1,13 @@
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.render.Renderer;
+
+public class DnDParamRenderer extends Renderer{
+
+ public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
+ }
+}
15 years, 7 months
JBoss Rich Faces SVN: r16427 - root/framework/trunk/impl/src/main/resources/META-INF/resources.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-02-08 10:36:56 -0500 (Mon, 08 Feb 2010)
New Revision: 16427
Modified:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js
Log:
data parameter was added
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js 2010-02-07 23:53:17 UTC (rev 16426)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js 2010-02-08 15:36:56 UTC (rev 16427)
@@ -14,32 +14,32 @@
},
bind : function(selector, type, fn, data) {
// type: namespace can be used, like onclick.rf.conponentName
- var f = function (e){
- e.data.fn.call(e.data.component||this, e, this);
+ var f = function (e,d){
+ e.data.fn.call(e.data.component||this, e, this, d);
};
$(selector).bind(type, {component: data, fn:fn}, f);
return f;
},
bindById : function(id, type, fn, data) {
// type: namespace can be used, like onclick.rf.conponentName
- var f = function (e){
- e.data.fn.call(e.data.component||this, e, this);
+ var f = function (e,d){
+ e.data.fn.call(e.data.component||this, e, this, d);
};
$(document.getElementById(id)).bind(type, {component: data, fn:fn}, f);
return f;
},
bindOne: function(selector, type, fn, data) {
// type: namespace can be used, like onclick.rf.conponentName
- var f = function (e){
- e.data.fn.call(e.data.component||this, e, this);
+ var f = function (e,d){
+ e.data.fn.call(e.data.component||this, e, this, d);
};
$(selector).one(type, {component: data, fn:fn}, f);
return f;
},
bindOneById: function(id, type, fn, data) {
// type: namespace can be used, like onclick.rf.conponentName
- var f = function (e){
- e.data.fn.call(e.data.component||this, e, this);
+ var f = function (e,d){
+ e.data.fn.call(e.data.component||this, e, this, d);
};
$(document.getElementById(id)).one(type, {component: data, fn:fn}, f);
return f;
15 years, 7 months
JBoss Rich Faces SVN: r16426 - root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-02-07 18:53:17 -0500 (Sun, 07 Feb 2010)
New Revision: 16426
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
Log:
https://jira.jboss.org/jira/browse/RF-7732
Service methods rendering code refactored
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-02-07 23:24:12 UTC (rev 16425)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-02-07 23:53:17 UTC (rev 16426)
@@ -26,6 +26,7 @@
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
+import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
@@ -45,6 +46,7 @@
import org.richfaces.builder.model.JavaMethod;
import org.richfaces.builder.model.JavaModifier;
import org.richfaces.builder.model.MethodBody;
+import org.richfaces.builder.model.MethodBodyStatement;
import org.richfaces.builder.model.MethodBodyStatementsContainer;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.Logger;
@@ -102,8 +104,8 @@
*/
static final String THIS_VARIABLE = "this";
/**
- *
- */
+ *
+ */
static final String SUPER_VARIABLE = "super";
/**
*
@@ -121,6 +123,81 @@
private static final Set<String> DEFAULT_NAMESPACES = ImmutableSet.of(Template.XHTML_EL_NAMESPACE,Template.XHTML_NAMESPACE);
+ private enum ServiceMethods {
+ EMPTY_CHECK("isEmpty", boolean.class, new Argument("object", Object.class)) {
+
+ @Override
+ public MethodBodyStatement createMethodBodyStatement() {
+ return new EmptinessCheckingMethodBodyStatement();
+ }
+
+ @Override
+ public boolean isServiceMethodRequired(ELVisitor visitor) {
+ return visitor.isUseEmptinessCheck();
+ }
+
+ },
+
+ TO_STRING_CONVERSION("convertToString", String.class, new Argument("object",
+ Object.class)) {
+
+ @Override
+ public MethodBodyStatement createMethodBodyStatement() {
+ return new ConversionToStringMethodBodyStatement();
+ }
+
+ @Override
+ public boolean isServiceMethodRequired(ELVisitor visitor) {
+ return visitor.isUseConversionToString();
+ }
+
+ },
+
+ EQUALS_CHECK("isEqual", boolean.class, new Argument("o1", Object.class),
+ new Argument("o2", Object.class)) {
+
+ @Override
+ public MethodBodyStatement createMethodBodyStatement() {
+ return new EqualsCheckingMethodBodyStatement();
+ }
+
+ @Override
+ public boolean isServiceMethodRequired(ELVisitor visitor) {
+ return visitor.isUseEqualsCheck();
+ }
+
+ };
+
+ private String name;
+
+ private Class<?> returnType;
+
+ private Argument[] arguments;
+
+ private ServiceMethods(String name, Class<?> returnType, Argument... arguments) {
+ this.name = name;
+ this.returnType = returnType;
+ this.arguments = arguments;
+ }
+
+ abstract MethodBodyStatement createMethodBodyStatement();
+
+ abstract boolean isServiceMethodRequired(ELVisitor visitor);
+
+ void createMethod(JavaClass generatedClass) {
+ JavaMethod conversionMethod = new JavaMethod(name, returnType, arguments);
+
+ conversionMethod.addModifier(JavaModifier.PRIVATE);
+ conversionMethod.addModifier(JavaModifier.FINAL);
+
+ MethodBody conversionMethodBody = new MethodBody(conversionMethod);
+ conversionMethod.setMethodBody(conversionMethodBody);
+ conversionMethodBody.addStatement(createMethodBodyStatement());
+
+ generatedClass.addMethod(conversionMethod);
+ }
+ }
+
private final Logger log;
@@ -134,10 +211,9 @@
private Map<String, Type> localsTypesMap;
private ClassLoader classLoader;
- private boolean isAddedMethodForConversionToString;
- private boolean isAddedMethodForCheckingEmptiness;
- private boolean isAddedMethodForCheckingEquals;
-
+
+ private Set<ServiceMethods> addedServiceMethods = EnumSet.noneOf(ServiceMethods.class);
+
private Type lastCompiledExpressionType;
private int passThroughCounter;
private Map<String, Property> attributes;
@@ -170,59 +246,12 @@
this.createMethodContext();
}
- private void addMethodForConversionToString() {
- if (!isAddedMethodForConversionToString) {
- isAddedMethodForConversionToString = true;
-
- JavaMethod conversionMethod = new JavaMethod("convertToString", String.class, new Argument("object",
- Object.class));
-
- conversionMethod.addModifier(JavaModifier.PRIVATE);
- conversionMethod.addModifier(JavaModifier.FINAL);
-
- MethodBody conversionMethodBody = new MethodBody(conversionMethod);
- conversionMethod.setMethodBody(conversionMethodBody);
- conversionMethodBody.addStatement(new ConversionToStringMethodBodyStatement());
-
- generatedClass.addMethod(conversionMethod);
+ private void addServiceMethod(ServiceMethods serviceMethod) {
+ if (addedServiceMethods.add(serviceMethod)) {
+ serviceMethod.createMethod(generatedClass);
}
}
- private void addMethodForCheckingEmptiness() {
- if (!isAddedMethodForCheckingEmptiness) {
- isAddedMethodForCheckingEmptiness = true;
-
- JavaMethod checkingMethod = new JavaMethod("isEmpty", boolean.class, new Argument("object", Object.class));
-
- checkingMethod.addModifier(JavaModifier.PRIVATE);
- checkingMethod.addModifier(JavaModifier.FINAL);
-
- MethodBody checkingMethodBody = new MethodBody(checkingMethod);
- checkingMethod.setMethodBody(checkingMethodBody);
- checkingMethodBody.addStatement(new EmptinessCheckingMethodBodyStatement());
-
- generatedClass.addMethod(checkingMethod);
- }
- }
-
- private void addMethodForCheckingEquals() {
- if (!isAddedMethodForCheckingEquals) {
- isAddedMethodForCheckingEquals = true;
-
- JavaMethod checkingMethod = new JavaMethod("isEqual", boolean.class, new Argument("o1", Object.class),
- new Argument("o2", Object.class));
-
- checkingMethod.addModifier(JavaModifier.PRIVATE);
- checkingMethod.addModifier(JavaModifier.FINAL);
-
- MethodBody checkingMethodBody = new MethodBody(checkingMethod);
- checkingMethod.setMethodBody(checkingMethodBody);
- checkingMethodBody.addStatement(new EqualsCheckingMethodBodyStatement());
-
- generatedClass.addMethod(checkingMethod);
- }
- }
-
private String compileEl(String expression, Class<?> type) {
try {
ELVisitor elVisitor = new ELVisitor();
@@ -231,18 +260,12 @@
lastCompiledExpressionType = elVisitor.getVariableType();
String parsedExpression = elVisitor.getParsedExpression();
- if (elVisitor.isUseConversionToString()) {
- addMethodForConversionToString();
+ for (ServiceMethods serviceMethod : ServiceMethods.values()) {
+ if (serviceMethod.isServiceMethodRequired(elVisitor)) {
+ addServiceMethod(serviceMethod);
+ }
}
- if (elVisitor.isUseEmptinessCheck()) {
- addMethodForCheckingEmptiness();
- }
-
- if (elVisitor.isUseEqualsCheck()) {
- addMethodForCheckingEquals();
- }
-
return parsedExpression + "/* " + expression.trim() + " */";
} catch (ParsingException e) {
// TODO Auto-generated catch block
@@ -322,7 +345,8 @@
public String apply(EventName from) {
return from.getName();
}
- });
+ }
+ );
sb.append(StringUtils.getEscapedStringsArray(eventNamesStrings));
15 years, 7 months
JBoss Rich Faces SVN: r16425 - in root: framework/trunk/version-matrix and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-02-07 18:24:12 -0500 (Sun, 07 Feb 2010)
New Revision: 16425
Modified:
root/cdk/trunk/pom.xml
root/framework/trunk/version-matrix/pom.xml
root/ui/trunk/version-matrix/pom.xml
Log:
Update policy for snapshots in CDK, Framework and UI modules reset from "never" to default value
Modified: root/cdk/trunk/pom.xml
===================================================================
--- root/cdk/trunk/pom.xml 2010-02-07 23:16:26 UTC (rev 16424)
+++ root/cdk/trunk/pom.xml 2010-02-07 23:24:12 UTC (rev 16425)
@@ -66,7 +66,6 @@
</releases>
<snapshots>
<enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
</snapshots>
<url>http://snapshots.jboss.org/maven2</url>
</repository>
@@ -90,7 +89,6 @@
</releases>
<snapshots>
<enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
</snapshots>
<url>http://snapshots.jboss.org/maven2</url>
</pluginRepository>
Modified: root/framework/trunk/version-matrix/pom.xml
===================================================================
--- root/framework/trunk/version-matrix/pom.xml 2010-02-07 23:16:26 UTC (rev 16424)
+++ root/framework/trunk/version-matrix/pom.xml 2010-02-07 23:24:12 UTC (rev 16425)
@@ -64,7 +64,6 @@
</releases>
<snapshots>
<enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
</snapshots>
<url>http://snapshots.jboss.org/maven2</url>
</repository>
@@ -88,7 +87,6 @@
</releases>
<snapshots>
<enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
</snapshots>
<url>http://snapshots.jboss.org/maven2</url>
</pluginRepository>
Modified: root/ui/trunk/version-matrix/pom.xml
===================================================================
--- root/ui/trunk/version-matrix/pom.xml 2010-02-07 23:16:26 UTC (rev 16424)
+++ root/ui/trunk/version-matrix/pom.xml 2010-02-07 23:24:12 UTC (rev 16425)
@@ -52,7 +52,6 @@
</releases>
<snapshots>
<enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
</snapshots>
<url>http://snapshots.jboss.org/maven2</url>
</repository>
@@ -76,7 +75,6 @@
</releases>
<snapshots>
<enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
</snapshots>
<url>http://snapshots.jboss.org/maven2</url>
</pluginRepository>
15 years, 7 months
JBoss Rich Faces SVN: r16424 - in root/framework/trunk: impl/src/test/java/org/richfaces/renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-02-07 18:16:26 -0500 (Sun, 07 Feb 2010)
New Revision: 16424
Modified:
root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/MockClientBehaviorHolder.java
root/framework/trunk/impl/src/test/java/org/richfaces/renderkit/CompositeRendererTest.java
Log:
Small fixes:
- Reverted changes in MockClientBehaviorHolder
- Added generic type for CompositeRendererTest
Modified: root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/MockClientBehaviorHolder.java
===================================================================
--- root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/MockClientBehaviorHolder.java 2010-02-07 23:14:28 UTC (rev 16423)
+++ root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/MockClientBehaviorHolder.java 2010-02-07 23:16:26 UTC (rev 16424)
@@ -21,7 +21,7 @@
*/
package org.richfaces.renderkit;
-//import static org.jboss.test.faces.mock.FacesMockController.invokeMethod;
+import static org.jboss.test.faces.mock.FacesMockController.invokeCurrent;
import java.util.Collection;
import java.util.List;
@@ -33,32 +33,26 @@
import org.easymock.IMocksControl;
import org.jboss.test.faces.mock.component.MockUIComponent;
-/**
- * TODO review this class
- * */
public class MockClientBehaviorHolder extends MockUIComponent implements ClientBehaviorHolder {
public MockClientBehaviorHolder(IMocksControl control, String name) {
- super(control/*, name*/);
+ super(control, name);
}
public void addClientBehavior(String eventName, ClientBehavior behavior) {
-// invokeCurrent(this, eventName, behavior);
+ invokeCurrent(this, eventName, behavior);
}
public Map<String, List<ClientBehavior>> getClientBehaviors() {
-// return invokeCurrent(this);
- return null;
+ return invokeCurrent(this);
}
public String getDefaultEventName() {
-// return invokeCurrent(this);
- return null;
+ return invokeCurrent(this);
}
public Collection<String> getEventNames() {
-// return invokeCurrent(this);
- return null;
+ return invokeCurrent(this);
}
}
Modified: root/framework/trunk/impl/src/test/java/org/richfaces/renderkit/CompositeRendererTest.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/richfaces/renderkit/CompositeRendererTest.java 2010-02-07 23:14:28 UTC (rev 16423)
+++ root/framework/trunk/impl/src/test/java/org/richfaces/renderkit/CompositeRendererTest.java 2010-02-07 23:16:26 UTC (rev 16424)
@@ -21,7 +21,7 @@
super.setUp();
setupFacesRequest();
this.compositeRenderer = new CompositeRenderer() {
- protected Class getComponentClass() {
+ protected Class<? extends UIComponent> getComponentClass() {
return UIComponent.class;
}
};
15 years, 7 months