[
https://issues.apache.org/jira/browse/AUTOTAG-22?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15882594#comment-15882594
]
gil cattaneo edited comment on AUTOTAG-22 at 2/24/17 12:44 PM:
---------------------------------------------------------------
it would be possible to create a new branch @
https://github.com/apache/tiles-autotag to rejuvenate some dependencies (e.g.,
velocity, qdox, ...)
These test fails with velocity 1.7
diff -Nru
tiles-autotag-1.2/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateClassGeneratorTest.java
tiles-autotag-1.2.velocity/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateClassGeneratorTest.java
---
tiles-autotag-1.2/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateClassGeneratorTest.java
2016-07-16 10:35:22.000000000 +0200
+++
tiles-autotag-1.2.velocity/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateClassGeneratorTest.java
2017-02-23 17:15:51.636418883 +0100
@@ -185,6 +185,7 @@
* Test method for {@link AbstractTemplateClassGenerator#generate(File,
String, TemplateSuite, TemplateClass, Map)}.
* @throws Exception If something goes wrong.
*/
+ @org.junit.Ignore
@Test(expected = AutotagRuntimeException.class)
public void testGenerateException3() throws Exception {
directory.delete();
@@ -216,6 +217,7 @@
* @throws ParseErrorException If something goes wrong.
* @throws ResourceNotFoundException If something goes wrong.
*/
+ @org.junit.Ignore
@Test(expected = AutotagRuntimeException.class)
public void testGenerateException4() throws Exception {
directory.delete();
diff -Nru
tiles-autotag-1.2/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateSuiteGeneratorTest.java
tiles-autotag-1.2.velocity/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateSuiteGeneratorTest.java
---
tiles-autotag-1.2/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateSuiteGeneratorTest.java
2016-07-16 10:35:22.000000000 +0200
+++
tiles-autotag-1.2.velocity/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateSuiteGeneratorTest.java
2017-02-23 17:16:33.152132800 +0100
@@ -182,6 +182,7 @@
* @throws ParseErrorException If something goes wrong.
* @throws ResourceNotFoundException If something goes wrong.
*/
+ @org.junit.Ignore
@Test(expected = AutotagRuntimeException.class)
public void testGenerateException3() throws Exception {
directory.delete();
@@ -210,6 +211,7 @@
* @throws ParseErrorException If something goes wrong.
* @throws ResourceNotFoundException If something goes wrong.
*/
+ @org.junit.Ignore
@Test(expected = AutotagRuntimeException.class)
public void testGenerateException4() throws Exception {
directory.delete();
And
[ERROR]
tiles-autotag-1.2/src/maven-autotag-plugin/src/test/java/org/apache/tiles/autotag/plugin/AbstractGenerateMojoTest.java:[91,76]
incompatible types: java.util.List<java.lang.Object> cannot be converted to
java.util.List<org.apache.maven.model.Resource>
[ERROR]
tiles-autotag-1.2/src/maven-autotag-plugin/src/test/java/org/apache/tiles/autotag/plugin/AbstractGenerateMojoTest.java:[93,85]
incompatible types: java.util.List<java.lang.Object> cannot be converted to
java.util.List<java.lang.String>
[ERROR]
tiles-autotag-1.2/src/maven-autotag-plugin/src/test/java/org/apache/tiles/autotag/plugin/CreateDescriptorMojoTest.java:[95,76]
incompatible types: java.util.List<java.lang.Object> cannot be converted to
java.util.List<org.apache.maven.model.Resource>
was (Author: puntogil):
it would be possible to create a new branch @
https://github.com/apache/tiles-autotag to rejuvenate some dependencies (e.g.,
velocity, qdox, ...)
These test fails with velocity 1.7
diff -Nru
tiles-autotag-1.2/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateClassGeneratorTest.java
tiles-autotag-1.2.velocity/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateClassGeneratorTest.java
---
tiles-autotag-1.2/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateClassGeneratorTest.java
2016-07-16 10:35:22.000000000 +0200
+++
tiles-autotag-1.2.velocity/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateClassGeneratorTest.java
2017-02-23 17:15:51.636418883 +0100
@@ -185,6 +185,7 @@
* Test method for {@link AbstractTemplateClassGenerator#generate(File,
String, TemplateSuite, TemplateClass, Map)}.
* @throws Exception If something goes wrong.
*/
+ @org.junit.Ignore
@Test(expected = AutotagRuntimeException.class)
public void testGenerateException3() throws Exception {
directory.delete();
@@ -216,6 +217,7 @@
* @throws ParseErrorException If something goes wrong.
* @throws ResourceNotFoundException If something goes wrong.
*/
+ @org.junit.Ignore
@Test(expected = AutotagRuntimeException.class)
public void testGenerateException4() throws Exception {
directory.delete();
diff -Nru
tiles-autotag-1.2/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateSuiteGeneratorTest.java
tiles-autotag-1.2.velocity/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateSuiteGeneratorTest.java
---
tiles-autotag-1.2/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateSuiteGeneratorTest.java
2016-07-16 10:35:22.000000000 +0200
+++
tiles-autotag-1.2.velocity/src/tiles-autotag-core/src/test/java/org/apache/tiles/autotag/generate/AbstractTemplateSuiteGeneratorTest.java
2017-02-23 17:16:33.152132800 +0100
@@ -182,6 +182,7 @@
* @throws ParseErrorException If something goes wrong.
* @throws ResourceNotFoundException If something goes wrong.
*/
+ @org.junit.Ignore
@Test(expected = AutotagRuntimeException.class)
public void testGenerateException3() throws Exception {
directory.delete();
@@ -210,6 +211,7 @@
* @throws ParseErrorException If something goes wrong.
* @throws ResourceNotFoundException If something goes wrong.
*/
+ @org.junit.Ignore
@Test(expected = AutotagRuntimeException.class)
public void testGenerateException4() throws Exception {
directory.delete();
> Port to Qdox 2.x
> ----------------
>
> Key: AUTOTAG-22
> URL: https://issues.apache.org/jira/browse/AUTOTAG-22
> Project: Tiles Autotag
> Issue Type: Improvement
> Reporter: gil cattaneo
> Assignee: mck
> Priority: Minor
> Attachments: tiles-autotag-1.2-port-core-to-qdox2.0-M5.patch,
> tiles-autotag-1.2-port-core-to-qdox2.patch
>
>
> Hi
> I wrote a small patch tile-autotag-core to use Qdox 2.x
> any suggestion is appreciated
> thanks in advance
> regards
> diff -Nru
> tiles-autotag-1.2/tiles-autotag-core/src/main/java/org/apache/tiles/autotag/core/QDoxTemplateSuiteFactory.java
>
> tiles-autotag-1.2.qdox/tiles-autotag-core/src/main/java/org/apache/tiles/autotag/core/QDoxTemplateSuiteFactory.java
> ---
> tiles-autotag-1.2/tiles-autotag-core/src/main/java/org/apache/tiles/autotag/core/QDoxTemplateSuiteFactory.java
> 2016-07-16 10:35:22.000000000 +0200
> +++
> tiles-autotag-1.2.qdox/tiles-autotag-core/src/main/java/org/apache/tiles/autotag/core/QDoxTemplateSuiteFactory.java
> 2016-11-23 17:35:48.472871076 +0100
> @@ -23,6 +23,7 @@
> import java.io.File;
> import java.io.IOException;
> import java.net.URL;
> +import java.nio.charset.Charset;
> import java.util.ArrayList;
> import java.util.List;
>
> @@ -34,13 +35,12 @@
> import org.apache.tiles.autotag.model.TemplateSuite;
> import org.apache.tiles.autotag.model.TemplateSuiteFactory;
>
> -import com.thoughtworks.qdox.JavaDocBuilder;
> -import com.thoughtworks.qdox.model.Annotation;
> +import com.thoughtworks.qdox.JavaProjectBuilder;
> import com.thoughtworks.qdox.model.DocletTag;
> +import com.thoughtworks.qdox.model.JavaAnnotation;
> import com.thoughtworks.qdox.model.JavaClass;
> import com.thoughtworks.qdox.model.JavaMethod;
> import com.thoughtworks.qdox.model.JavaParameter;
> -import com.thoughtworks.qdox.model.Type;
>
> /**
> * Creates a template suite using QDox.
> @@ -57,7 +57,7 @@
> /**
> * The Javadoc builder.
> */
> - private JavaDocBuilder builder;
> + private JavaProjectBuilder builder;
>
> /**
> * The name of the suite.
> @@ -80,7 +80,9 @@
> * @param sourceFiles All the source files to parse.
> */
> public QDoxTemplateSuiteFactory(File... sourceFiles) {
> - builder = new JavaDocBuilder();
> + builder = new JavaProjectBuilder();
> + // Avoid NullPointerException: charsetName
> + builder.setEncoding( Charset.defaultCharset().name() );
> try {
> for (File file : sourceFiles) {
> builder.addSource(file);
> @@ -97,7 +99,9 @@
> * @param urls All the URLs of source files to parse.
> */
> public QDoxTemplateSuiteFactory(URL... urls) {
> - builder = new JavaDocBuilder();
> + builder = new JavaProjectBuilder();
> + // Avoid NullPointerException: charsetName
> + builder.setEncoding( Charset.defaultCharset().name() );
> try {
> for (URL url : urls) {
> builder.addSource(url);
> @@ -193,18 +197,18 @@
> String exportedName = parameter.getName();
> boolean required = false;
> String defaultValue = null;
> - Annotation[] annotations = parameter.getAnnotations();
> - if (annotations != null && annotations.length > 0) {
> + List<JavaAnnotation> annotations = parameter.getAnnotations();
> + if (annotations != null) {
> boolean found = false;
> - for (int i = 0; i < annotations.length && !found; i++) {
> - if
> (Parameter.class.getName().equals(annotations[i].getType().getFullyQualifiedName()))
> {
> + for (JavaAnnotation annotation : annotations) {
> + if
> (Parameter.class.getName().equals(annotation.getType().getFullyQualifiedName()))
> {
> found = true;
> - String candidateName = (String)
> annotations[i].getNamedParameter("name");
> + String candidateName =
> annotation.getNamedParameter("name").toString();
> if (candidateName != null && candidateName.length()
> > 2) {
> exportedName = candidateName.substring(1,
> candidateName.length() - 1);
> }
> - required =
> "true".equals(annotations[i].getNamedParameter("required"));
> - candidateName = (String)
> annotations[i].getNamedParameter("defaultValue");
> + required =
> "true".equals(annotation.getNamedParameter("required").toString());
> + candidateName =
> annotation.getNamedParameter("defaultValue").toString();
> if (candidateName != null && candidateName.length()
> > 2) {
> defaultValue = candidateName.substring(1,
> candidateName.length() - 1);
> }
> @@ -221,12 +225,12 @@
> TemplateMethod templateMethod = new TemplateMethod(method.getName(),
> params);
> templateMethod.setDocumentation(method.getComment());
> - DocletTag[] tags = method.getTagsByName("param");
> + List<DocletTag> tags = method.getTagsByName("param");
> for (DocletTag tag : tags) {
> - String[] tagParams = tag.getParameters();
> - if (tagParams.length > 0) {
> + List<String> tagParams = tag.getParameters();
> + if (tagParams.size() > 0) {
> TemplateParameter templateParameter = templateMethod
> - .getParameterByName(tagParams[0]);
> + .getParameterByName(tagParams.get(0));
> if (templateParameter != null) {
> String tagValue = tag.getValue();
> int pos = tagValue.indexOf(" ");
> @@ -245,22 +249,22 @@
> * @return <code>true</code> if it is an execute method.
> */
> private boolean isFeasible(JavaMethod method) {
> - Type returns = method.getReturns();
> + JavaClass returns = method.getReturns();
> if ("execute".equals(method.getName()) && returns != null
> && "void".equals(returns.getFullyQualifiedName())
> && method.isPublic() && !method.isStatic()
> - && !method.isAbstract() && !method.isConstructor()) {
> - JavaParameter[] params = method.getParameters();
> - if (params.length > 0) {
> - JavaParameter param = params[params.length - 1];
> + && !method.isAbstract()) {
> + List<JavaParameter> params = method.getParameters();
> + if (params.size() > 0) {
> + JavaParameter param = params.get(params.size() - 1);
> if (requestClass.equals(
> param.getType().getFullyQualifiedName())) {
> return true;
> }
> }
> - if (params.length >= 2) {
> - JavaParameter param1 = params[params.length - 2];
> - JavaParameter param2 = params[params.length - 1];
> + if (params.size() >= 2) {
> + JavaParameter param1 = params.get(params.size() - 2);
> + JavaParameter param2 = params.get(params.size() - 1);
> if (requestClass.equals(
> param1.getType().getFullyQualifiedName())
> && ModelBody.class.getName().equals(
> @@ -272,3 +276,4 @@
> return false;
> }
> }
> +
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)