## Guide for Extensions

### 3 Testbed Provider Services (Testbed to FIESTA-IoT)

#### 3.3 TPS Implementation (Wildfly Container)

A TPS instance may be implemented in any language and or environment the Testbed provider chooses to as long as it follows the above API as a REST web service. Shall you choose to implement it in Java we provide a skeleton Java project in order to help you bootstrap the process. Information where this project can be found and to be used is provided in the following sections.

#### Code Availability and Structure

The Testbed Provider Interface components are offered at FIESTA-IoT GitHub repository, which can be found here: https://github.com/fiesta-iot. The latest version of the components are under the “develop branch”.

The project is divided into two main packages. The “eu.fiestaiot.tpi.api.tps.rest” and “eu.fiestaiot.tpi.api.tps.impl.dataservices”:

eu.fiestaiot.tpi.api.tps.rest

Within this package, the “TpiApiTestbedProviderServices.java”[1]  class can be found which is the entry point for the Services described at the TPS API above.

The two main methods of interest are:

These methods analyse the payload and forwards it to the implementation of them, which resides in the following package.

eu.fiestaiot.tpi.api.tps.impl.dataservices

In this package, we have a list of the implementations classes of the different web services exposed from the TPS instance. The Testbed provider needs to implement at least one of them. The two classes are:
• GetLastObservationsImpl.java[2]
• GetObservationsImpl.java[3]

#### System Requirements

The TPS component described above is deployed within a WildFly container and is using Maven as project management.

The prototype runs on Windows, Linux, Mac OS X, and Solaris. In order to run the prototype, you need to ensure that Java 8 and WildFly are installed and/or available on your system. In order to build the prototype you will also need Maven. Before attempting to deploy and run the prototype applications, make sure that you have started WildFly. More details about the specific versions of the tools and libraries that have been used for the development or that are required for the deployment and execution of the prototypes are given in the section below.

#### Install & Run

The prototype has been implemented as a Maven-based web application. Below WILDFLY_HOME indicates the root directory of the WildFly distribution, and PROJECT_HOME indicates the root directory of the project.

In order to configure the prototype,

1. make sure that all properties listed in $PROJECT_HOME/src/main/resources/fiesta-iot.properties have the appropriate values, 2. copy that file into$WILDFLY_HOME/standalone/configuration, and
3. issue the following commands:

In order to build the prototype, run the following command in PROJECT_HOME:

mvn clean package

Finally, in order to deploy the prototype, run the following command in PROJECT_HOME:

mvn wildfly:deploy
The last step assumes that WildFly is already running on the machine where you run the command.
The produced (from the build process above) project is the tpi.api.tps-X.war file. Alternatively copy the produced (from the build process above) ProjectName.war file from the target directory (\$PROJECT_HOME/target/), into the standalone/deployments directory of the WildFly distribution, in order to be automatically deployed.

If the deployment has been successfully completed, you will be able to access all web services described in the section above using the following URLs:

• http://[HOST]:[PORT]/tpi.api.tps/rest/tps/getLastObservations
• http://[HOST]:[PORT]/tpi.api.tps/rest/tps/getObservations
where [HOST] is the host and [PORT] the port that WildFly uses.

[1] /tpi.api.tps/src/main/java/eu/fiestaiot/tpi/api/tps/rest/TpiApiTestbedProviderServices.java

[2] /tpi.api.tps/src/main/java/eu/fiestaiot/tpi/api/tps/impl/dataservices/GetLastObservationsImpl.java

[3] /tpi.api.tps/src/main/java/eu/fiestaiot/tpi/api/tps/impl/dataservices/GetObservationsImpl.java