summaryrefslogtreecommitdiffstats
path: root/bindings/func-java
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/func-java')
-rw-r--r--bindings/func-java/lib/mvn-install-lib.sh1
-rw-r--r--bindings/func-java/lib/org/jvyaml/jvyaml.jarbin0 -> 174560 bytes
-rw-r--r--bindings/func-java/pom.xml91
-rw-r--r--bindings/func-java/src/main/groovy/org/func/FuncFactory.groovy48
-rw-r--r--bindings/func-java/src/main/groovy/org/func/FuncImpl.groovy135
-rw-r--r--bindings/func-java/src/main/java/org/func/Func.java123
-rw-r--r--bindings/func-java/src/main/java/org/func/exceptions/CertmasterException.java35
-rw-r--r--bindings/func-java/src/main/java/org/func/exceptions/FuncCommunicationException.java35
-rw-r--r--bindings/func-java/src/test/groovy/FuncFactoryTest.groovy32
-rw-r--r--bindings/func-java/src/test/groovy/org/func/FuncFactoryTest.groovy38
-rw-r--r--bindings/func-java/src/test/groovy/org/func/FuncImplTest.groovy62
11 files changed, 600 insertions, 0 deletions
diff --git a/bindings/func-java/lib/mvn-install-lib.sh b/bindings/func-java/lib/mvn-install-lib.sh
new file mode 100644
index 0000000..4ba6789
--- /dev/null
+++ b/bindings/func-java/lib/mvn-install-lib.sh
@@ -0,0 +1 @@
+mvn install:install-file -DgroupId=org.jvyaml -DartifactId=jvyaml -Dversion=1.1 -Dpackaging=jar -Dfile=org/jvyaml/jvyaml.jar
diff --git a/bindings/func-java/lib/org/jvyaml/jvyaml.jar b/bindings/func-java/lib/org/jvyaml/jvyaml.jar
new file mode 100644
index 0000000..55e2db3
--- /dev/null
+++ b/bindings/func-java/lib/org/jvyaml/jvyaml.jar
Binary files differ
diff --git a/bindings/func-java/pom.xml b/bindings/func-java/pom.xml
new file mode 100644
index 0000000..01668a4
--- /dev/null
+++ b/bindings/func-java/pom.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.func</groupId>
+ <artifactId>func-java</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>Func-Java Bindings</name>
+ <url>https://fedorahosted.org/func</url>
+
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jvyaml</groupId>
+ <artifactId>jvyaml</artifactId>
+ <version>1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.5.6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo.groovy</groupId>
+ <artifactId>groovy-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>SourceCompile</id>
+ <phase>compile</phase>
+ <goals>
+ <!-- <goal>generateStubs</goal> -->
+ <goal>compile</goal>
+ <!-- <goal>generateTestStubs</goal> -->
+ <!-- <goal>testCompile</goal> -->
+ </goals>
+ <configuration>
+ <sources>
+ <fileset>
+ <directory>${pom.basedir}/src/main</directory>
+ <includes>
+ <include>**/*.groovy</include>
+ </includes>
+ </fileset>
+ </sources>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>TestCompile</id>
+ <goals>
+ <goal>testCompile</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <fileset>
+ <directory>${pom.basedir}/src/test/groovy</directory>
+ <includes>
+ <include>**/*.groovy</include>
+ </includes>
+ </fileset>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/bindings/func-java/src/main/groovy/org/func/FuncFactory.groovy b/bindings/func-java/src/main/groovy/org/func/FuncFactory.groovy
new file mode 100644
index 0000000..84d3d7b
--- /dev/null
+++ b/bindings/func-java/src/main/groovy/org/func/FuncFactory.groovy
@@ -0,0 +1,48 @@
+package org.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:03:20 AM
+ *
+ * @author Marco Mornati
+ * @e-mail mmornati@byte-code.com
+ * @version 1.0
+ */
+class FuncFactory {
+
+ /**
+ * Factory class method. You need to call this method to obtain an instance of Func classes
+ * @return Func instances. To use for func invokation.
+ */
+ public static Func getFunc() {
+ Func funcImplementation = new FuncImpl()
+
+ return funcImplementation
+ }
+
+ /**
+ * Factory class method. You need to call this method to obtain an instance of Func classes
+ * @param funcTransmit You can specify folder where your func-transmit is located. By default it must be in your path.
+ * @return Func instances. To use for func invokation.
+ */
+ public static Func getFunc(String funcTransmit) {
+ Func funcImplementation = new FuncImpl(funcTransmit)
+
+ return funcImplementation
+ }
+
+} \ No newline at end of file
diff --git a/bindings/func-java/src/main/groovy/org/func/FuncImpl.groovy b/bindings/func-java/src/main/groovy/org/func/FuncImpl.groovy
new file mode 100644
index 0000000..332f72c
--- /dev/null
+++ b/bindings/func-java/src/main/groovy/org/func/FuncImpl.groovy
@@ -0,0 +1,135 @@
+package org.func
+
+import org.func.exceptions.FuncCommunicationException
+import org.jvyaml.YAML
+import org.func.exceptions.CertmasterException
+
+/**
+ * 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 10, 2008
+ * Time: 5:38:02 PM
+ *
+ * @author Marco Mornati
+ * @e-mail mmornati@byte-code.com
+ * @version 1.0
+ */
+class FuncImpl implements Func {
+
+ private funcTransmit = "func-transmit"
+ private func = "func"
+
+ public FuncImpl() {
+
+ }
+
+ public FuncImpl(String transmit) {
+ this.funcTransmit = transmit
+ }
+
+ public Map call(String client, String module, String method) throws FuncCommunicationException {
+ this.call([client], module, method, null)
+ }
+
+ public Map call(List clients, String module, String method) throws FuncCommunicationException {
+ this.call(clients, module, method, null)
+ }
+
+ public Map call(String client, String module, String method, String parameter) throws FuncCommunicationException {
+ this.call([client], module, method, [parameter])
+ }
+
+ public Map call(List clients, String module, String method, List parameters) throws FuncCommunicationException {
+ return funcCall(clients, module, method, parameters)
+ }
+
+ public Map listModules(String client) {
+ return this.listModules([client])
+ }
+
+ public Map listModuleMethods(String client, String method) {
+ return this.listModuleMethods([client], method)
+ }
+
+ public Map listModules(List clients) {
+ return funcCall(clients, "system", "list_modules", null)
+ }
+
+ public Map listModuleMethods(List clients, String module) {
+ return funcCall(clients, module, "list_methods", null)
+ }
+
+
+ public List listMinions() {
+ def minions = []
+ def commandToExecute = [func, "*", "list_minions"]
+ def proc = commandToExecute.execute()
+ proc.waitFor()
+ def procAnswer = proc.text
+ if (procAnswer) {
+ minions = procAnswer.split("\n")
+ } else {
+ throw new CertmasterException("Error communicating with certmaster")
+ }
+ return minions;
+ }
+
+
+ private Map funcCall(List clients, String module, String method, List parameters) throws FuncCommunicationException {
+ def values = [clients: clientsCallPatch(clients), module: module, method: method, parameters: parameters]
+ def yamlDump = YAML.dump(values)
+ def commandToExecute = [funcTransmit]
+ def proc = commandToExecute.execute()
+ proc.withWriter {writer -> writer << yamlDump }
+ proc.waitFor()
+ def procAnswer = proc.text
+ Map funcResponse = null
+ if (procAnswer) {
+ def response = YAML.load(procAnswer)
+ if (response instanceof Map) {
+ funcResponse = (Map) response
+ }
+ } else {
+ throw new FuncCommunicationException(procAnswer + " - Error reading answer from Func-Transmit Process!")
+ }
+ return funcResponse
+ }
+
+
+ private String clientsCallPatch(List clients) {
+ //TODO: Now Func does not accept a LIST of client (you can send a list with a string formatted like client1;client2;client
+ //TODO: Change this patch when func will be ready
+ //===== PATCH BEGINS
+ String clientToSend = ""
+ clients?.each {
+ if (!clientToSend.equals("")) {
+ clientToSend += ";"
+ }
+ clientToSend += "${it}"
+ }
+ return clientToSend
+ //===== PATCH ENDS
+ }
+
+ public void setFuncTransmit(String funcTransmit) {
+ this.funcTransmit = funcTransmit
+ }
+
+ public String getFuncTransmit() {
+ return funcTransmit
+ }
+
+} \ No newline at end of file
diff --git a/bindings/func-java/src/main/java/org/func/Func.java b/bindings/func-java/src/main/java/org/func/Func.java
new file mode 100644
index 0000000..d0d09a2
--- /dev/null
+++ b/bindings/func-java/src/main/java/org/func/Func.java
@@ -0,0 +1,123 @@
+package org.func;
+
+import org.func.exceptions.FuncCommunicationException;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Copyright (C) 2008, Byte-Code srl <http://www.byte-code.com>
+ * <p/>
+ * 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.
+ * <p/>
+ * 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.
+ * <p/>
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * <p/>
+ * Date: Jul 10, 2008
+ * Time: 5:35:26 PM
+ *
+ * @author Marco Mornati
+ * @e-mail mmornati@byte-code.com
+ * @version 1.0
+ */
+public interface Func {
+
+ /**
+ * Function invoked to optain the list of func client (machine that you can control in your java application using this API).
+ * @return List of String with machine hostname
+ */
+ public List listMinions();
+
+ /**
+ * Caller for func-transmit with single client and no parameter
+ * @param client Func client name. To invoke all defined clients use "*"
+ * @param module Name of func module (use listModules to obtain the available modules)
+ * @param method Name of method to invoke
+ * @return Map with client name as key and func response as value
+ * @throws FuncCommunicationException thrown if there is any kind of error in func invokation
+ */
+ public Map call (String client, String module, String method) throws FuncCommunicationException;
+
+ /**
+ * Caller for func-transmit with list of clients and no parameter
+ * @param clients List of Func clients.
+ * @param module Name of func module (use listModules to obtain the available modules)
+ * @param method Name of method to invoke
+ * @return Map with responses divided for each client: client name as key and func response as value
+ * @throws FuncCommunicationException thrown if there is any kind of error in func invokation
+ */
+ public Map call (List clients, String module, String method) throws FuncCommunicationException;
+
+ /**
+ * Caller for func-transmit with single client and single parameter
+ * @param client List of Func clients.
+ * @param module Name of func module (use listModules to obtain the available modules)
+ * @param method Name of method to invoke
+ * @param parameter parameter to use with your method. Passed during func-transmit invokation
+ * @return Map with responses divided for each client: client name as key and func response as value
+ * @throws FuncCommunicationException thrown if there is any kind of error in func invokation
+ */
+ public Map call (String client, String module, String method, String parameter) throws FuncCommunicationException;
+
+ /**
+ * Func-Transmit Caller. It generates a Process to invoke func-transmit (using Yaml as default message) and then
+ * it parses the output provided from func to generate a Map returned to your application.
+ *
+ * The Map content is something like this:
+ *
+ * [client_name1: func response for this client (could be a simple string, another map, ...),
+ * client_name2: func response]
+ *
+ * @param clients List of Func clients.
+ * @param module Name of func module (use listModules to obtain the available modules)
+ * @param method Name of method to invoke
+ * @param parameters list of parameters to use with your method. Passed during func-transmit invokation
+ * @return Map with responses divided for each client: client name as key and func response as value
+ * @throws FuncCommunicationException thrown if there is any kind of error in func invokation
+ */
+ public Map call (List clients, String module, String method, List parameters) throws FuncCommunicationException;
+
+ /**
+ * Invoked to obtain for specified client the list of func module installed
+ *
+ * @param client Name of the client to use with func. To invoke all defined clients use "*"
+ * @return Map with clientName as key and list of all installed func module as object
+ * @throws FuncCommunicationException thrown if there is any kind of error in func invokation
+ */
+ public Map listModules (String client) throws FuncCommunicationException;
+
+ /**
+ * Invoked to obtain for specified list of clients, the list of func module installed
+ * @param clients List of func clients names.
+ * @return Map with response divided for each client: clientName as key and list of all installed func module as value
+ * @throws FuncCommunicationException thrown if there is any kind of error in func invokation
+ */
+ public Map listModules (List clients) throws FuncCommunicationException;
+
+ /**
+ * Invoked to obtain the list of methods for provided module and client
+ * @param client client Name of the client to use with func. To invoke all defined clients use "*"
+ * @param module name of func module for which you need a list of methods
+ * @return Map with client name as key and list of module's methods as value
+ * @throws FuncCommunicationException thrown if there is any kind of error in func invokation
+ */
+ public Map listModuleMethods (String client, String module) throws FuncCommunicationException;
+
+ /**
+ * Invoked to obtain the list of methods for provided module and list of clients
+ * @param clients List of func clients names.
+ * @param module name of func module for which you need a list of methods
+ * @return Map with response divided for each client: clientName as key and list of all module's methods as value
+ * @throws FuncCommunicationException thrown if there is any kind of error in func invokation
+ */
+ public Map listModuleMethods (List clients, String module) throws FuncCommunicationException;
+
+}
diff --git a/bindings/func-java/src/main/java/org/func/exceptions/CertmasterException.java b/bindings/func-java/src/main/java/org/func/exceptions/CertmasterException.java
new file mode 100644
index 0000000..dcab042
--- /dev/null
+++ b/bindings/func-java/src/main/java/org/func/exceptions/CertmasterException.java
@@ -0,0 +1,35 @@
+package org.func.exceptions;
+
+/**
+ * Copyright (C) 2008, Byte-Code srl <http://www.byte-code.com>
+ * <p/>
+ * 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.
+ * <p/>
+ * 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.
+ * <p/>
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * <p/>
+ * Date: Jul 11, 2008
+ * Time: 3:21:04 PM
+ *
+ * @author Marco Mornati
+ * @e-mail mmornati@byte-code.com
+ * @version 1.0
+ */
+public class CertmasterException extends Exception {
+
+ public CertmasterException(Exception e) {
+ super(e);
+ }
+
+ public CertmasterException(String message) {
+ super(message);
+ }
+}
diff --git a/bindings/func-java/src/main/java/org/func/exceptions/FuncCommunicationException.java b/bindings/func-java/src/main/java/org/func/exceptions/FuncCommunicationException.java
new file mode 100644
index 0000000..ccee91f
--- /dev/null
+++ b/bindings/func-java/src/main/java/org/func/exceptions/FuncCommunicationException.java
@@ -0,0 +1,35 @@
+package org.func.exceptions;
+
+/**
+ * Copyright (C) 2008, Byte-Code srl <http://www.byte-code.com>
+ * <p/>
+ * 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.
+ * <p/>
+ * 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.
+ * <p/>
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * <p/>
+ * Date: Jul 11, 2008
+ * Time: 10:44:46 AM
+ *
+ * @author Marco Mornati
+ * @e-mail mmornati@byte-code.com
+ * @version 1.0
+ */
+public class FuncCommunicationException extends Exception {
+
+ public FuncCommunicationException(Exception e) {
+ super(e);
+ }
+
+ public FuncCommunicationException(String message) {
+ super(message);
+ }
+}
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