lang-groovy: new tests and documentation review!
Project: http://git-wip-us.apache.org/repos/asf/zest-qi4j/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-qi4j/commit/cccbc92d Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/cccbc92d Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/cccbc92d Branch: refs/heads/develop Commit: cccbc92db02a3f9a2793d0ddd88ac8b4be4b131e Parents: 6413657 Author: Paul Merlin <[email protected]> Authored: Wed Jul 8 17:06:42 2015 +0200 Committer: Paul Merlin <[email protected]> Committed: Wed Jul 8 17:06:42 2015 +0200 ---------------------------------------------------------------------- libraries/lang-groovy/build.gradle | 1 + libraries/lang-groovy/dev-status.xml | 4 +- libraries/lang-groovy/src/docs/lang-groovy.txt | 87 ++++++++++++++++---- .../org/qi4j/lang/groovy/GroovyComposite.java | 23 ++++++ .../org/qi4j/lang/groovy/GroovyMixinTest.java | 46 +++++++++++ .../org/qi4j/lang/groovy/HelloSpeaker.java | 19 +++++ .../qi4j/lang/groovy/HelloSpeakerMixin.groovy | 26 ++++++ .../org/qi4j/lang/groovy/HelloSpeakerTest.java | 79 ++++++++++++++++++ .../groovy/org/qi4j/lang/groovy/Mixin1.java | 24 ++++++ .../org/qi4j/lang/groovy/GroovyComposite.java | 23 ------ .../org/qi4j/lang/groovy/GroovyMixinTest.java | 46 ----------- .../java/org/qi4j/lang/groovy/HelloSpeaker.java | 25 ------ .../test/java/org/qi4j/lang/groovy/Mixin1.java | 24 ------ .../org/qi4j/lang/groovy/HelloSpeaker.groovy | 25 ++++++ .../lang/groovy/HelloSpeaker.sayHello.groovy | 20 +++++ manual/src/docs/userguide/libraries.txt | 24 +++--- 16 files changed, 347 insertions(+), 149 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/libraries/lang-groovy/build.gradle ---------------------------------------------------------------------- diff --git a/libraries/lang-groovy/build.gradle b/libraries/lang-groovy/build.gradle index d273a17..13f2578 100644 --- a/libraries/lang-groovy/build.gradle +++ b/libraries/lang-groovy/build.gradle @@ -21,6 +21,7 @@ description = "Apache Zest⢠Groovy Library allows for Mixins to be implemented jar { manifest { name = "Apache Zest⢠Library - Scripting - Groovy" }} +apply plugin: 'groovy' dependencies { compile(project(":org.qi4j.core:org.qi4j.core.bootstrap")) http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/libraries/lang-groovy/dev-status.xml ---------------------------------------------------------------------- diff --git a/libraries/lang-groovy/dev-status.xml b/libraries/lang-groovy/dev-status.xml index 58fda09..2a02725 100644 --- a/libraries/lang-groovy/dev-status.xml +++ b/libraries/lang-groovy/dev-status.xml @@ -24,10 +24,10 @@ <codebase>beta</codebase> <!-- none, brief, good, complete --> - <documentation>brief</documentation> + <documentation>good</documentation> <!-- none, some, good, complete --> - <unittests>some</unittests> + <unittests>good</unittests> </status> <licenses> <license>ALv2</license> http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/libraries/lang-groovy/src/docs/lang-groovy.txt ---------------------------------------------------------------------- diff --git a/libraries/lang-groovy/src/docs/lang-groovy.txt b/libraries/lang-groovy/src/docs/lang-groovy.txt index f92d8ae..b45ddf2 100644 --- a/libraries/lang-groovy/src/docs/lang-groovy.txt +++ b/libraries/lang-groovy/src/docs/lang-groovy.txt @@ -29,28 +29,81 @@ Groovy Scripting Library include::../../build/docs/buildinfo/artifact.txt[] -The Groovy Scripting Library is a Generic mixin that implements interfaces -by delegating to Groovy functions using Groovy. Each method in an interface -is declared by a Groovy method in a file located in classpath with the name -"<interface>.groovy", where the interface name includes the package, and has -"." replaced with "/". +The Groovy Scripting Library is a Generic mixin that implements interfaces by delegating to Groovy code from classpath resources. -Example +But before looking at how to use the Scripting library we'll see that *you don't need this library at all if you simply need to use Groovy classes as Fragments*. +Then we'll see how to use Groovy class scripts and method scripts. - org/qi4j/samples/hello/domain/HelloWorldSpeaker.groovy - org/qi4j/samples/hello/domain/HelloWorldSpeaker.sayAgain.groovy +All examples below are based on this type: -That means that the HelloWorldSpeaker.groovy file may be co-located with the -class files in the same package. It is currently not supported to place -the Groovy implementation of the mixin in a different package than the -interface it implements. +[snippet,java] +---- +source=libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeaker.java +tag=speaker +---- + + +== Using compiled Groovy classes == + +To directly use compiled Groovy classes as Fragments you don't need this library at all. + +Having this Groovy class compiled ; + +.HelloSpeakerMixin.groovy +[snippet,groovy] +---- +source=libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerMixin.groovy +tag=direct +---- + +assemble it directly: + +[snippet,java] +---- +source=libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerTest.java +tag=direct +---- + + +== Using Groovy class scripts == -To use Groovy to implement the Mixin functionality for a given interface, -simply declare the +GroovyMixin+ like any other mixin, either in the interface -or at assembly time. +Declare a Groovy class in a classpath resource file located in the same package as the implemented type with the name +<type>.groovy+: + +.HelloSpeaker.groovy +[snippet,groovy] +---- +source=libraries/lang-groovy/src/test/resources/org/qi4j/lang/groovy/HelloSpeaker.groovy +tag=script +---- + +Then assemble it with the +GroovyMixin+: [snippet,java] ---- -source=libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/HelloSpeaker.java -tag=mixin +source=libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerTest.java +tag=script ---- + +Groovy class scripts get +@This+ injection in a +This+ property if present. + + +== Using Groovy method scripts == + +Implement single composites methods, each in a classpath resource file located in the same package as the implemented type with the name +<type>.<method>.groovy+: + +.HelloSpeaker.sayHello.groovy +[snippet,groovy] +---- +source=libraries/lang-groovy/src/test/resources/org/qi4j/lang/groovy/HelloSpeaker.sayHello.groovy +tag=script +---- + +Then assemble it with the +GroovyMixin+: + +[snippet,java] +---- +source=libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerTest.java +tag=script +---- + +Groovy method scripts get +@This+ injection as +This+ property and the methods arguments array as +args+. http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/GroovyComposite.java ---------------------------------------------------------------------- diff --git a/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/GroovyComposite.java b/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/GroovyComposite.java new file mode 100644 index 0000000..31765f8 --- /dev/null +++ b/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/GroovyComposite.java @@ -0,0 +1,23 @@ +/* + * Copyright 2008 Niclas Hedhman + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ +package org.qi4j.lang.groovy; + +import org.qi4j.api.composite.TransientComposite; +import org.qi4j.api.mixin.Mixins; + +/** + * JAVADOC + */ +@Mixins( GroovyMixin.class ) +public interface GroovyComposite extends Mixin1, TransientComposite +{ +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/GroovyMixinTest.java ---------------------------------------------------------------------- diff --git a/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/GroovyMixinTest.java b/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/GroovyMixinTest.java new file mode 100644 index 0000000..976f0bc --- /dev/null +++ b/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/GroovyMixinTest.java @@ -0,0 +1,46 @@ +/* + * Copyright 2007-2008 Niclas Hedhman + * Copyright 2007-2008 Rickard Ãberg + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ +package org.qi4j.lang.groovy; + +import org.junit.Assert; +import org.junit.Test; +import org.qi4j.bootstrap.AssemblyException; +import org.qi4j.bootstrap.ModuleAssembly; +import org.qi4j.test.AbstractQi4jTest; + +public class GroovyMixinTest extends AbstractQi4jTest +{ + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.transients( GroovyComposite.class ); + } + + @Test + public void testInvoke() + { + GroovyComposite domain1 = module.newTransient( GroovyComposite.class ); + GroovyComposite domain2 = module.newTransient( GroovyComposite.class ); + Assert.assertEquals( "do1() in Groovy:1", domain1.do1() ); + Assert.assertEquals( "do1() in Groovy:2", domain1.do1() ); + Assert.assertEquals( "do1() in Groovy:3", domain1.do1() ); + Assert.assertEquals( "do1() in Groovy:4", domain1.do1() ); + Assert.assertEquals( "do1() in Groovy:1", domain2.do1() ); + Assert.assertEquals( "do1() in Groovy:2", domain2.do1() ); + Assert.assertEquals( "do1() in Groovy:3", domain2.do1() ); + Assert.assertEquals( "do1() in Groovy:4", domain2.do1() ); + Assert.assertEquals( "do1() in Groovy:5", domain2.do1() ); + Assert.assertEquals( "do1() in Groovy:6", domain2.do1() ); + Assert.assertEquals( "do1() in Groovy:5", domain1.do1() ); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeaker.java ---------------------------------------------------------------------- diff --git a/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeaker.java b/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeaker.java new file mode 100644 index 0000000..9dc0388 --- /dev/null +++ b/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeaker.java @@ -0,0 +1,19 @@ +/* + * Copyright 2007 Rickard Ãberg + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ +package org.qi4j.lang.groovy; + +// START SNIPPET: speaker +public interface HelloSpeaker +{ + String sayHello( String name ); +} +// END SNIPPET: speaker http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerMixin.groovy ---------------------------------------------------------------------- diff --git a/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerMixin.groovy b/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerMixin.groovy new file mode 100644 index 0000000..f1ba758 --- /dev/null +++ b/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerMixin.groovy @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2015 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.qi4j.lang.groovy; + +// START SNIPPET: direct +public class HelloSpeakerMixin implements HelloSpeaker { + public String sayHello( String name ) { + "Hello $name!" + } +} +// END SNIPPET: direct http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerTest.java ---------------------------------------------------------------------- diff --git a/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerTest.java b/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerTest.java new file mode 100644 index 0000000..1ef9124 --- /dev/null +++ b/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerTest.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2015 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.qi4j.lang.groovy; + +import org.junit.Assert; +import org.junit.Test; +import org.qi4j.bootstrap.AssemblyException; +import org.qi4j.bootstrap.ModuleAssembly; +import org.qi4j.test.AbstractQi4jTest; +import org.qi4j.bootstrap.SingletonAssembler; + +public class HelloSpeakerTest extends AbstractQi4jTest +{ + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.transients( HelloSpeaker.class ).withMixins( GroovyMixin.class ); + } + + @Test + public void testHello() + { + HelloSpeaker speaker = module.newTransient( HelloSpeaker.class ); + Assert.assertEquals( "Hello World!", speaker.sayHello( "World" ) ); + } + + @Test + public void testGroovyScriptResourceMixin() + throws Exception + { + // START SNIPPET: script + SingletonAssembler assembler = new SingletonAssembler() + { + @Override + public void assemble( ModuleAssembly assembly ) + throws AssemblyException + { + assembly.transients( HelloSpeaker.class ).withMixins( GroovyMixin.class ); + } + }; + HelloSpeaker speaker = assembler.module().newTransient( HelloSpeaker.class ); + Assert.assertEquals( "Hello World!", speaker.sayHello( "World" ) ); + // END SNIPPET: script + } + + @Test + public void testGroovyClassMixin() + throws Exception + { + // START SNIPPET: direct + SingletonAssembler assembler = new SingletonAssembler() + { + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.transients( HelloSpeaker.class ).withMixins( HelloSpeakerMixin.class ); + } + }; + HelloSpeaker speaker = assembler.module().newTransient( HelloSpeaker.class ); + Assert.assertEquals( "Hello World!", speaker.sayHello( "World" ) ); + // END SNIPPET: direct + } +} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/Mixin1.java ---------------------------------------------------------------------- diff --git a/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/Mixin1.java b/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/Mixin1.java new file mode 100644 index 0000000..1184a32 --- /dev/null +++ b/libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/Mixin1.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.qi4j.lang.groovy; + +public interface Mixin1 +{ + String do1(); +} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/GroovyComposite.java ---------------------------------------------------------------------- diff --git a/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/GroovyComposite.java b/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/GroovyComposite.java deleted file mode 100644 index 31765f8..0000000 --- a/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/GroovyComposite.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2008 Niclas Hedhman - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package org.qi4j.lang.groovy; - -import org.qi4j.api.composite.TransientComposite; -import org.qi4j.api.mixin.Mixins; - -/** - * JAVADOC - */ -@Mixins( GroovyMixin.class ) -public interface GroovyComposite extends Mixin1, TransientComposite -{ -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/GroovyMixinTest.java ---------------------------------------------------------------------- diff --git a/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/GroovyMixinTest.java b/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/GroovyMixinTest.java deleted file mode 100644 index 976f0bc..0000000 --- a/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/GroovyMixinTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2007-2008 Niclas Hedhman - * Copyright 2007-2008 Rickard Ãberg - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package org.qi4j.lang.groovy; - -import org.junit.Assert; -import org.junit.Test; -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.ModuleAssembly; -import org.qi4j.test.AbstractQi4jTest; - -public class GroovyMixinTest extends AbstractQi4jTest -{ - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.transients( GroovyComposite.class ); - } - - @Test - public void testInvoke() - { - GroovyComposite domain1 = module.newTransient( GroovyComposite.class ); - GroovyComposite domain2 = module.newTransient( GroovyComposite.class ); - Assert.assertEquals( "do1() in Groovy:1", domain1.do1() ); - Assert.assertEquals( "do1() in Groovy:2", domain1.do1() ); - Assert.assertEquals( "do1() in Groovy:3", domain1.do1() ); - Assert.assertEquals( "do1() in Groovy:4", domain1.do1() ); - Assert.assertEquals( "do1() in Groovy:1", domain2.do1() ); - Assert.assertEquals( "do1() in Groovy:2", domain2.do1() ); - Assert.assertEquals( "do1() in Groovy:3", domain2.do1() ); - Assert.assertEquals( "do1() in Groovy:4", domain2.do1() ); - Assert.assertEquals( "do1() in Groovy:5", domain2.do1() ); - Assert.assertEquals( "do1() in Groovy:6", domain2.do1() ); - Assert.assertEquals( "do1() in Groovy:5", domain1.do1() ); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/HelloSpeaker.java ---------------------------------------------------------------------- diff --git a/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/HelloSpeaker.java b/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/HelloSpeaker.java deleted file mode 100644 index 369918e..0000000 --- a/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/HelloSpeaker.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2007 Rickard Ãberg - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package org.qi4j.lang.groovy; - -import org.qi4j.api.mixin.Mixins; - -// START SNIPPET: mixin -import org.qi4j.lang.groovy.GroovyMixin; - - -@Mixins(GroovyMixin.class) -public interface HelloSpeaker -{ - void sayHello(); -} -// END SNIPPET: mixin http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/Mixin1.java ---------------------------------------------------------------------- diff --git a/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/Mixin1.java b/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/Mixin1.java deleted file mode 100644 index 1184a32..0000000 --- a/libraries/lang-groovy/src/test/java/org/qi4j/lang/groovy/Mixin1.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.qi4j.lang.groovy; - -public interface Mixin1 -{ - String do1(); -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/libraries/lang-groovy/src/test/resources/org/qi4j/lang/groovy/HelloSpeaker.groovy ---------------------------------------------------------------------- diff --git a/libraries/lang-groovy/src/test/resources/org/qi4j/lang/groovy/HelloSpeaker.groovy b/libraries/lang-groovy/src/test/resources/org/qi4j/lang/groovy/HelloSpeaker.groovy new file mode 100644 index 0000000..eac3726 --- /dev/null +++ b/libraries/lang-groovy/src/test/resources/org/qi4j/lang/groovy/HelloSpeaker.groovy @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2015 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// START SNIPPET: script +class HelloSpeaker { + def This + def sayHello( name ) { + "Hello $name!".toString() + } +} +// END SNIPPET: script http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/libraries/lang-groovy/src/test/resources/org/qi4j/lang/groovy/HelloSpeaker.sayHello.groovy ---------------------------------------------------------------------- diff --git a/libraries/lang-groovy/src/test/resources/org/qi4j/lang/groovy/HelloSpeaker.sayHello.groovy b/libraries/lang-groovy/src/test/resources/org/qi4j/lang/groovy/HelloSpeaker.sayHello.groovy new file mode 100644 index 0000000..48a525e --- /dev/null +++ b/libraries/lang-groovy/src/test/resources/org/qi4j/lang/groovy/HelloSpeaker.sayHello.groovy @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2015 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// START SNIPPET: script +"Hello ${args[0]}!".toString() +// END SNIPPET: script http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/cccbc92d/manual/src/docs/userguide/libraries.txt ---------------------------------------------------------------------- diff --git a/manual/src/docs/userguide/libraries.txt b/manual/src/docs/userguide/libraries.txt index 742dcbf..7b0a2d3 100644 --- a/manual/src/docs/userguide/libraries.txt +++ b/manual/src/docs/userguide/libraries.txt @@ -31,6 +31,18 @@ for our users. :leveloffset: 2 +include::../../../../libraries/lang-groovy/src/docs/lang-groovy.txt[] + +:leveloffset: 2 + +include::../../../../libraries/lang-javascript/src/docs/lang-javascript.txt[] + +:leveloffset: 2 + +include::../../../../libraries/lang-scala/src/docs/lang-scala.txt[] + +:leveloffset: 2 + include::../../../../libraries/alarm/src/docs/alarm.txt[] :leveloffset: 2 @@ -111,18 +123,6 @@ include::../../../../libraries/scheduler/src/docs/scheduler.txt[] :leveloffset: 2 -include::../../../../libraries/lang-groovy/src/docs/lang-groovy.txt[] - -:leveloffset: 2 - -include::../../../../libraries/lang-javascript/src/docs/lang-javascript.txt[] - -:leveloffset: 2 - -include::../../../../libraries/lang-scala/src/docs/lang-scala.txt[] - -:leveloffset: 2 - include::../../../../libraries/servlet/src/docs/servlet.txt[] :leveloffset: 2
