Approvals: 0/1
[06:05:41] <Anil> Hello - i am trying to build a rest api with data source interaction using vertx [06:06:00] <Anil> can some one help me in validating the approach ?
[07:40:04] * ChanServ sets mode: +o temporalfox [07:45:57] * ChanServ sets mode: +o temporalfox
[09:03:59] * ChanServ sets mode: +o temporalfox [10:44:46] * ChanServ sets mode: +o temporalfox
[11:11:16] * ChanServ sets mode: +o temporalfox [14:59:22] * ChanServ sets mode: +o temporalfox
[17:44:38] <aesteve> hello everyone ! :)
[17:45:36] <aesteve> temporalfox: I thought about your comment about @DataObject the other day, and I'm wondering if Groovy's AST transformations couldn't help
[17:45:53] <temporalfox> which comment ?
[17:46:12] <temporalfox> as DataObject ?
[17:46:20] <aesteve> yes that kind of stuff
[17:46:22] <temporalfox> I'm not a fan of AST transformation
[17:46:29] <temporalfox> although I find that very powerful
[17:46:46] <temporalfox> I think something like vertx sync could be done using AST transformation
[17:46:54] <temporalfox> by rewriting AST
[17:47:07] <aesteve> but it clinged to my mind, that by default in a Groovy environment, @DataObject could generate all the needed stuff (fromJson, toJson) thanks to an AST transformation
[17:48:02] <temporalfox> we do that using AST
[17:48:05] <temporalfox> it generates a Converter class
[17:48:12] <temporalfox> because such code is quite error prone
[17:48:23] <aesteve> oh that's what you were telling me too
[17:48:37] <aesteve> the “generates the boilerplate code” thing
[17:48:44] <aesteve> I'll have a look
[17:49:19] <temporalfox> for instance
[17:49:19] <temporalfox> https://github.com/eclipse/vert.x/blob/master/src/main/generated/io/vertx/core/DeploymentOptionsConverter.java
[17:49:28] <temporalfox> is generated from data object
[17:50:15] <aesteve> ok that's basically what I had in mind
[17:50:18] <aesteve> :)
[17:51:05] <aesteve> now I'm still thinking about what I could add to ease web development in groovy
[17:51:41] <temporalfox> support for groovy templates
[17:51:52] <aesteve> very good point
[17:52:03] <aesteve> but my PR is bugged and I don't know why
[17:53:48] <aesteve> https://github.com/vert-x3/vertx-web/compare/master...aesteve:groovy-template-engines2?expand=1
[17:54:30] <aesteve> there are problems in “enums.adoc” for example
[18:00:48] <temporalfox> ah I did not see you did a PR
[18:01:03] <temporalfox> why didn't we merge it ?
[18:08:09] <aesteve> i didn't send the PR yet
[18:08:21] <aesteve> the link is just the PR “preparation”
[18:08:46] <aesteve> but if you look carefully, there are modifications about enums.adoc I have no clue where they come from
[18:09:18] <aesteve> and second problem, the “create” method isn't codegen friendly
[18:14:53] <temporalfox> it is hard to see this problem from here
[18:15:19] <aesteve> yeah obviously :\
[18:15:50] <aesteve> for the enums I have really no clue, but for the codegen stuff, maybe you can give me an advice
[18:16:08] <aesteve> the problem is that there are different template engines in Groovy
[18:16:19] <aesteve> Markup, Simple, …
[18:17:18] <temporalfox> why are you using codegen enums with groovy ?
[18:17:24] <temporalfox> can I try to build it ?
[18:17:36] <aesteve> yes !
[18:17:46] <aesteve> that must be a build problem
[18:17:55] <aesteve> but I can't figure out what I did wrong
[18:18:02] <temporalfox> ok
[18:18:02] <temporalfox> I'm going to try now
[18:18:22] <temporalfox> should I clone this ? https://github.com/aesteve/vertx-web/tree/groovy-template-engines2
[18:18:28] <aesteve> idd
[18:19:34] <temporalfox> and the branch groovy-template-engines2
[18:19:58] <aesteve> it's this branch, idd.
[18:21:59] <aesteve> you'll notice the io.vertx.ext.web.templ.GroovyTemplateEngine.create() is @GenIgnore'd
[18:22:00] <aesteve> https://github.com/aesteve/vertx-web/blob/groovy-template-engines2/vertx-template-engines/vertx-web-templ-groovy/src/main/java/io/vertx/ext/web/templ/GroovyTemplateEngine.java#L32-L34
[18:22:18] <aesteve> and it's more a design, than a VertxGen question
[18:22:31] <temporalfox> so it builds
[18:22:46] <temporalfox> I see this
[18:22:49] <temporalfox> yes
[18:22:53] <temporalfox> so what is the problem ?
[18:23:12] <temporalfox> can't you have a
[18:23:12] <temporalfox> static HandlebarsTemplateEngine create()
[18:23:20] <aesteve> actually not
[18:23:23] <temporalfox> that does not use a groovy.text.TemplateEngine ?
[18:23:40] <aesteve> because it can be a GStringTemplateEngine, MarkupTemplateEngine
[18:23:53] <aesteve> and they're really different
[18:24:02] <temporalfox> so you need to make a
[18:24:13] <temporalfox> createGStringTemplateEngine and a createMarkupTemplateEngine static
[18:24:41] <temporalfox> which one is the latest from C[unknown:eacute]dric Champeau ?
[18:24:52] <temporalfox> it's MarkupTemplateEngine
[18:24:53] <temporalfox> I think
[18:25:20] <aesteve> idd
[18:26:06] <temporalfox> static GroovyTemplateEngine createMarkupTemplateEngine() {
[18:26:10] <temporalfox> return new GroovyTemplateEngineImpl(new MarkupTemplateEngine());
[18:26:33] <aesteve> I did that at some point
[18:26:44] <aesteve> but I wasn't happy with it
[18:26:48] <temporalfox> so what is the problem ?
[18:27:00] <aesteve> http://docs.groovy-lang.org/latest/html/api/groovy/text/markup/MarkupTemplateEngine.html#MarkupTemplateEngine(java.lang.ClassLoader,%20groovy.text.markup.TemplateConfiguration,%20groovy.text.markup.TemplateResolver)
[18:27:13] <aesteve> there's templateconfiguration stuff for example
[18:27:31] <temporalfox> you should make the config
[18:27:36] <temporalfox> with a data object
[18:27:41] <aesteve> ok
[18:27:42] <temporalfox> like a MarkupConfig
[18:27:46] <aesteve> didn't think about this
[18:28:19] <temporalfox> you could also maybe
[18:28:20] <temporalfox> do a TemplateResolver
[18:28:25] <temporalfox> using vertx file system
[18:28:34] <aesteve> I'll have to
[18:28:49] <temporalfox> I can try to do these to see how it works
[18:28:53] <aesteve> the most painful stuff will be the tests
[18:29:24] <aesteve> actually, I'm not even sure Handlebars templateresolver is tested but it should (it's the same thing)
[18:29:35] <aesteve> inclusion / composition
[18:32:22] <aesteve> what do you wanna try ? templateresolver or markupconfig ?
[18:33:13] <temporalfox> markupconfig
[18:33:14] <temporalfox> first
[18:33:23] <temporalfox> does vertx uses locale stuff somewhere ?
[18:33:39] <temporalfox> I'm seing a Locale and don't know how it is handled in general
[18:33:55] <aesteve> http://vertx.io/docs/apidocs/io/vertx/ext/web/RoutingContext.html#preferredLocale–
[18:34:24] <aesteve> something very useful from vertx-web
[18:35:02] <temporalfox> ok there is own locale class
[20:33:24] <temporalfox> I don't understand how the “somedir” works in tests
[20:33:43] <aesteve> let me see
[20:35:46] <aesteve> https://github.com/aesteve/vertx-web/tree/groovy-template-engines2/vertx-web/src/test/resources/somedir
[20:35:57] <aesteve> it's within the 'root' vertx-web project
[20:36:30] <aesteve> iirc it's for testing that templates can be loaded either from the classpath or the fs
[20:36:52] <aesteve> but tbch I tried to mimic what was done with handlebars
[21:29:12] <temporalfox> aesteve these tests don't pass for existing classes like XMLTemplateTest
[21:29:21] <temporalfox> Caused by: java.nio.file.NoSuchFileException: somedir/test-xml-template2.gtpl
[21:29:21] <temporalfox> at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
[21:29:21] <temporalfox> at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
[21:29:21] <temporalfox> at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
[21:29:23] <temporalfox> at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
[21:29:28] <temporalfox> is it expected ?
[21:29:52] <aesteve> no, and they pass on my machine
[21:30:19] <aesteve> are the handlebars test broken, too ?
[21:33:21] <temporalfox> I haven't tried them
[21:35:16] <aesteve> mmh ok
[21:44:29] <temporalfox> perhaps it is because I'm trying it in the vertx-web-templ-groovy folder itself
[21:44:50] <aesteve> maybe
[21:45:09] <aesteve> i was about to ask if you were running them from maven or your IDE
[21:46:13] <aesteve> I'm abit lost since the project has been refactored into small pieces (template engines are now subprojects)
[21:46:49] <aesteve> actually I had to install IntelliJ since Eclipse doesn't “like” subprojects
[22:05:20] <aesteve> actually, the project doesn't compile anymore on my computer
[22:05:41] <aesteve> [ERROR] /Users/arnaud/git/vertx-web/vertx-web/src/main/java/io/vertx/ext/web/handler/sockjs/impl/SockJSSession.java:[62,1] io.vertx.ext.web.handler.sockjs.impl.SockJSSession is not abstract and does not override abstract method end() in io.vertx.core.streams.WriteStream
[22:06:49] <temporalfox> yes
[22:07:01] <temporalfox> you need to rebase on latest master
[22:07:05] <temporalfox> I run from maven
[22:17:29] <aesteve> mvn clean test
[22:17:36] <aesteve> just gives me 1 test failure : SockJSProtocolTest.testProtocol:77→AsyncTestBase.assertEquals:431 Protocol tests failed expected:<0> but was:<2>
[22:17:46] <aesteve> but templates are OK
[22:19:33] <aesteve> got the same error within the vertx-template-engines dir
[22:19:37] <aesteve> … :(
[22:25:14] <aesteve> ok so it's the opposite from what I remembered, they're running from the IDE, but not from Maven
[22:25:18] <aesteve> I'll have a look
[22:25:24] <aesteve> god it's so painful
[22:35:59] <temporal_>
[22:36:15] <temporal_> let's say what CI says
[22:36:21] <temporal_> let' see
[22:36:45] <temporal_> CI seems happy
[22:36:51] <aesteve> actually, the problem is I'm completely lost, I use to work with Gradle, Eclipse, and flat projects
[22:36:55] <temporal_> have you changed something that would make this test fail ?
[22:36:57] <temporal_> ok
[22:37:09] <aesteve> and I have to use Maven, Nested projects and IntelliJ
[22:37:44] <aesteve> atm it does no longer compile on my computer I have no clue why, “TemplateEngine” cannot be found
[22:38:13] <aesteve> just like if groovy-temp-engine wasn't a subproject of vertx-web
[22:38:24] <aesteve> that makes no sense to me :D
[22:39:04] <aesteve> I think the problem lies in maven, and maybe <artifactSet>
[22:39:04] <aesteve> <includes>
[22:39:04] <aesteve> <include>*:groovy</include>
[22:39:04] <aesteve> <include>org.apache.commons:commons-lang3</include>
[22:39:04] <aesteve> <include>org.antlr:*</include>
[22:39:04] <aesteve> <!– run in no-rhino mode (do not include rhino) –>
[22:39:04] <aesteve> </includes>
[22:40:48] <aesteve> since it's the shade plugin config, isn't it used to package resources when it runs the tests ?
[22:40:51] <aesteve> no idea ^^
[22:54:15] <aesteve> doesn't work either. No idea what I should do. It's the exact same thing as handlebars, idk why maven doesn't find the 'somedir' directory
[22:56:00] <temporal_> does handlebar sees it ?
[22:56:21] <aesteve> the handlebars test don't fail, they work just fine
[22:56:25] <aesteve> maven or IDE, both
[22:56:28] <temporal_> seems ok for me
[22:56:40] <aesteve> but mines are failing
[22:56:52] <aesteve> only with maven, IntelliJ has no problem
[22:56:53] <temporal_> maven shade plugin is only for packaging
[22:56:56] <temporal_> not testing
[22:57:07] <aesteve> yes and the test-jar dependency is in the POM
[22:59:24] <temporal_> yes
[22:59:28] <temporal_> let's find out!
[22:59:46] <temporal_> I think it's the resolver thing
[22:59:52] <temporal_> that does not load template from classpath
[23:00:03] <temporal_> has it ever worked ?
[23:01:31] <aesteve> it used to work in the very first version before the project was split into submodules
[23:01:38] <temporal_> ok
[23:02:55] <aesteve> so : return new GStringTemplateEngine(Utils.getClassLoader());
[23:03:12] <aesteve> mmh no actually
[23:03:27] <aesteve> the file is sent to TemplateEngine by TemplateHandler iirc
[23:04:03] <aesteve> the resolver will only be used by the template engine if another template is included (i think)
[23:04:15] <temporal_> ah in my case it fails
[23:04:15] <temporal_> because I changed some logic in tes tinit
[23:04:24] <temporal_> so perhaps we don't see same failure
[23:05:15] <temporal_> now it passes
[23:05:21] <temporal_> ah no
[23:05:25] <temporal_> I mean yes
[23:05:27] <temporal_> but one does not
[23:05:31] <temporal_> testTemplateOnClasspath
[23:05:34] <temporal_> like you
[23:05:52] <temporal_> actually it is
[23:05:53] <temporal_> testGetGroovyEngine
[23:06:23] <temporal_> it's because I changed the test
[23:06:42] <temporal_> because the create() I'm doing does not use a template engine as argument
[23:06:49] <temporal_> so the test doe snot init it anymore
[23:06:50] <aesteve> yes that makes sense
[23:07:15] <aesteve> but the classpath thing works ??
[23:07:23] <temporal_> it seems to
[23:07:31] <temporal_> for XmlTemplateTest at least
[23:07:54] <temporal_> let me push that somewhere once it works fully
[23:08:04] <aesteve> I'd be glad to
[23:08:34] <aesteve> because the line failing is : String rawTpl = Utils.readFileToString(vertx, loc);
[23:10:00] <temporal_> try that
[23:10:01] <temporal_> https://github.com/vietj/vertx-web/tree/groovy-template-engines2
[23:10:15] <temporal_> it works from cmd line
[23:13:09] <aesteve> same issue
[23:13:23] <aesteve> Caused by: io.vertx.core.file.FileSystemException: java.nio.file.NoSuchFileException: somedir/test-gstring-template2.gtpl
[23:13:35] <temporal_> are you running from CLI ?
[23:13:42] <temporal_> in which directory are you ?
[23:13:49] <temporal_> I'm running from the groovy dir
[23:14:35] <aesteve> same
[23:14:51] <aesteve> macbook-air-de-arnaud:vertx-template-engines arnaud$ pwd
[23:15:36] <temporal_> juliens-mbp-2:vertx-web-templ-groovy julien$ pwd
[23:15:40] <aesteve> ## /tmp/vertx-web/vertx-template-engines
[23:15:49] <temporal_> “/Users/julien/java/vertx-web-aesteve/vertx-template-engines/vertx-web-templ-groovy”
[23:15:49] <aesteve> irc doesnt like '/'
[23:17:03] <aesteve> same within the groovy dir
[23:17:08] <aesteve> same OS, same project
[23:17:24] <temporal_> have you tried from my fork ?
[23:17:31] <aesteve> yes the /tmp
[23:17:34] <aesteve> is your fork
[23:19:10] *** ChanServ sets mode: +o temporalfox
[23:21:10] <aesteve> yes that's your fork, on the groovy-template-engines2 branch
[23:21:39] <aesteve> I can see the MarkupConfig class
[23:23:25] <aesteve> the important thing is that it works for you and the CI
[23:23:27] <aesteve> :D
[23:27:49] <temporalfox> it should work for you
[23:28:44] <aesteve> what's really really weird
[23:29:01] <aesteve> is that IntelliJ has absolutely no issue running the tests
[23:29:08] <aesteve> but maven does
[23:30:53] <temporalfox> what is your maven version ?
[23:31:08] <temporalfox> I'm using v
[23:31:09] <temporalfox> 3.2.5
[23:31:39] <aesteve> 3.3.3
[23:33:07] <aesteve> but even if it was a version issue, handlebars or thymeleaf would fail, too
[23:34:54] <aesteve> I _must_ have done something wrong :) but what ? that's crazy