diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2008-07-11 16:53:26 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2008-07-11 16:53:26 -0400 |
commit | 210249ab81e5b4cad1575f6c2a21d06b360531b9 (patch) | |
tree | d6a768f7532fa42cffd9d65f05699b922469e112 /bindings/func-java/src/test/groovy | |
parent | 5c713b017d2af83da11f7b77e188fd0c2686b3c3 (diff) | |
download | func-210249ab81e5b4cad1575f6c2a21d06b360531b9.tar.gz func-210249ab81e5b4cad1575f6c2a21d06b360531b9.tar.xz func-210249ab81e5b4cad1575f6c2a21d06b360531b9.zip |
Merging Marco's func bindings
Diffstat (limited to 'bindings/func-java/src/test/groovy')
3 files changed, 132 insertions, 0 deletions
diff --git a/bindings/func-java/src/test/groovy/FuncFactoryTest.groovy b/bindings/func-java/src/test/groovy/FuncFactoryTest.groovy new file mode 100644 index 0000000..fd0ab86 --- /dev/null +++ b/bindings/func-java/src/test/groovy/FuncFactoryTest.groovy @@ -0,0 +1,32 @@ +import org.func.FuncFactory +import org.func.Func + +/** + * Copyright (C) 2008, Byte-Code srl <http://www.byte-code.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Date: Jul 11, 2008 + * Time: 10:06:03 AM + */ +class FuncFactoryTest extends GroovyTestCase { + + void testFuncFactory() { + def func = FuncFactory.getFunc() + + assertNotNull ("Func Factory returns a null Func Implementation", func) + assertTrue ("Func Factory does not return a correct Func object", func instanceof Func) + } + +}
\ No newline at end of file diff --git a/bindings/func-java/src/test/groovy/org/func/FuncFactoryTest.groovy b/bindings/func-java/src/test/groovy/org/func/FuncFactoryTest.groovy new file mode 100644 index 0000000..0cbc0f7 --- /dev/null +++ b/bindings/func-java/src/test/groovy/org/func/FuncFactoryTest.groovy @@ -0,0 +1,38 @@ +package org.func + +import org.func.FuncFactory +import org.func.Func + +/** + * Copyright (C) 2008, Byte-Code srl <http://www.byte-code.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Date: Jul 11, 2008 + * Time: 10:06:03 AM + * + * @author Marco Mornati + * @e-mail mmornati@byte-code.com + * @version 1.0 + */ +class FuncFactoryTest extends GroovyTestCase { + + void testFuncFactory() { + def func = FuncFactory.getFunc() + + assertNotNull("Func Factory returns a null Func Implementation", func) + assertTrue("Func Factory does not return a correct Func object", func instanceof Func) + } + +}
\ No newline at end of file diff --git a/bindings/func-java/src/test/groovy/org/func/FuncImplTest.groovy b/bindings/func-java/src/test/groovy/org/func/FuncImplTest.groovy new file mode 100644 index 0000000..cd9ce60 --- /dev/null +++ b/bindings/func-java/src/test/groovy/org/func/FuncImplTest.groovy @@ -0,0 +1,62 @@ +package org.func + +import org.jvyaml.YAML + +/** + * Copyright (C) 2008, Byte-Code srl <http://www.byte-code.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Date: Jul 11, 2008 + * Time: 10:30:47 AM + * + * @author Marco Mornati + * @e-mail mmornati@byte-code.com + * @version 1.0 + * + */ +class FuncImplTest extends GroovyTestCase { + + void testCall() { + Func func = FuncFactory.getFunc("/home/mmornati/projects/func/scripts/func-transmit") + def response = func.call ("*", "hardware", "info") + assertTrue ("Func Response is not a Map", response instanceof Map) + } + + void testListModules() { + Func func = FuncFactory.getFunc("/home/mmornati/projects/func/scripts/func-transmit") + def response = func.listModules("bcmmornati") + assertTrue ("Func Response is not a Map", response instanceof Map) + } + + void testListModuleMethods() { + Func func = FuncFactory.getFunc("/home/mmornati/projects/func/scripts/func-transmit") + def response = func.listModuleMethods("bcmmornati", "hardware") + assertTrue ("Func Response is not a Map", response instanceof Map) + } + + void testClientPatch() { + def clients = ["client1", "client2"] + FuncImpl func = FuncFactory.getFunc() + def returned = func.clientsCallPatch(clients) + assertEquals ("Error in ClientsPatch generation", returned, "client1;client2") + } + + void testListMinions() { + Func func = FuncFactory.getFunc() + def response = func.listMinions() + assertTrue ("Error in calling listMinions", response instanceof List) + } + +}
\ No newline at end of file |