From 210249ab81e5b4cad1575f6c2a21d06b360531b9 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Fri, 11 Jul 2008 16:53:26 -0400 Subject: Merging Marco's func bindings --- .../src/test/groovy/FuncFactoryTest.groovy | 32 +++++++++++ .../test/groovy/org/func/FuncFactoryTest.groovy | 38 +++++++++++++ .../src/test/groovy/org/func/FuncImplTest.groovy | 62 ++++++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 bindings/func-java/src/test/groovy/FuncFactoryTest.groovy create mode 100644 bindings/func-java/src/test/groovy/org/func/FuncFactoryTest.groovy create mode 100644 bindings/func-java/src/test/groovy/org/func/FuncImplTest.groovy (limited to 'bindings/func-java/src/test') 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 + * + * 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 . + * + * 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 + * + * 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 . + * + * 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 + * + * 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 . + * + * 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 -- cgit