This service was created as a result of the OpenReq project funded by the European Union Horizon 2020 Research and Innovation programme under grant agreement No. 732463.
Pabre Swagger file can be found at: OpenReq Server
The following technologies are used:
- Jersey REST framework (→ https://jersey.github.io/ )
- Hibernate (→ http://hibernate.org/ )
- Derby embedded database (→ http://db.apache.org/derby/ )
- Swagger (→ https://swagger.io/ )
- Maven (→ https://maven.apache.org/ )
- Apache Tomcat (→ http://tomcat.apache.org/)
- DKPro (→ https://dkpro.github.io/ )
- Postman (→ https://www.getpostman.com/)
- Functionalities of the Web service
- Installing with Eclipse
- Build the project with Maven
- Build the project with Maven plugin in Eclipse
- Running the project with
pabre-ws.war - Running the project with
pabre-ws.jar - Developers
- Switching database
requirement-patterns
The services offers the following features:
- REST service to manage requirement patterns
- REST service to manage complete catalogue with many schemas having they own patterns
- Store all the information in the embedded database
-
Get the source code:
-
Download the zip or clone the project with git:
https://mast-tuleap.informatik.uni-hamburg.de/plugins/git/openreq/upc/requirement-patterns.git
-
-
Run Eclipse
-
Goto File > Import > Maven > Existing Maven Projects
-
Go to the folder where the project is located and press Finish
-
To ensure that the libraries are downloaded: right click on the proyect > Maven > Update Project
-
Open command line in pabre-ws
-
Build the project:
-
Generate only
pabre-ws.warwith:mvn clean install -
Generate
pabre-ws.warandpabre-ws.jar(with embedded Tomcat7):mvn clean install tomcat7:exec-war-only
-
-
Open the project
-
Go to Run configuration:
Right click on project > Run As > Maven build... -
Set the configuration: Name:
pabre-ws derbyEmGoals :clean install tomcat7:exec-war-only -
Press
Run -
You can obtain the
pabre-ws.warandpabre-ws.jarinside the/targetfolder
Important: by default pabre-ws uses a embedded derby database, derby uses the directory where it is been executed . For example: running the
startup.shis been executed inapache-tomcat-7.0.90/bin, so the Derby database will be create a database with the routeapache-tomcat-7.0.90/bin/pabreDatabase, if the user dosen't have permission to write, it will be created in the system temporary files, console will show you the used route
There are 2 ways to run with pabre.ws
-
Modifying the
pabre-ws.warbefore deploy- Obtain the
pabre-ws.war - Open the
pabre-ws.waras a .zip/.rar folder - Open the
hibernate.cfg.xmllocated inWEB-INF/classes/config - Modify the file with the follow items:
hibernate.connection.username: Username of the database (Optional).hibernate.connection.password: Password of the database (Optional).connection.directory: The directory where the database should be created or is located. By default: directory where the tomcat is been executed. (cannot end in/)connection.database.name: Database name, by default is pabreDatabase (Optional).
- Save and accept the war update
- Go to your own
Tomcatfolder - Copy the war inside
webappsfolder - Start the
Tomcat
- Obtain the
-
Modifying after deploy
- Obtain the
pabre-ws.war - Copy the
pabre-ws.warinto the Tomcat webapps folder - When the war is deployed (folder created), Stop the
Tomcat - Go to
pabre-ws/WEB-INF/classes/config - Open the
hibernate.cfg.xmllocated inWEB-INF/classes/config - Modify the file with the follow items:
hibernate.connection.username: Username of the database (Optional).hibernate.connection.password: Password of the database (Optional).connection.directory: The directory where the database should be created or is located. By default: directory where the tomcat is been executed. (cannot end in/)connection.database.name: Database name, by default is pabreDatabase (Optional).
- Save the file
- Start the
Tomcat
- Obtain the
Important: by default pabre-ws uses a embedded derby database, derby uses the directory where it is been executed . In this case, when you execute
pabre-ws.jarin the same directory it will be created a folder with the namepabreDatabase. In case that the user don't have permission to write in that folder, the database will be created in the system temp folder, The console will show you which route has been used.
Important: The default port used by the Embedded tomcat is 9408.
- Obtain the
pabre-ws.jar - Execute:
java -jar pabre-ws.jar - Embedded Tomcat7 will be executed and you can now access
http://localhost:9408/pabre-ws/api/
-
Database:While developing is recomended to use the Client/Server derby configuration with the profile
derby, otherwise embedded derby take some time while is shutting down. To change the profile of execution:- Right click on the project
- Click on
Properties - Select
Maven - Write
derbyinside active maven profile
-
Tests: To test all the WS Postman is being used.
- The tests location: inside the
src/main/resources/testsare 2 files:- PABRE-WS.postman_collection.json: This file there are all the tests to be executed by Postman
- PABRE-WS.postman_environment.json: This file contains all the environment needed to execute the tests (the variable baseUrl should be updated with the server URL where service is being executed to test it)
- How to execute the tests:
- Install the command Newman
- Go to the project root directory
- Execute the command:
newman run pabre-ws/src/main/resources/tests/PABRE-WS.postman_collection.json -e pabre-ws/src/main/resources/tests/PABRE-WS.postman_environment.json
- The tests location: inside the
Pabre use Hibernate library, so it can switch between different databases.
In hibernate.cfg.xml we can write the configuration. Some examples of diferrents configurations:
<!-- Database connection settings -->
<property name="hibernate.connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
<property name="hibernate.connection.url"></property>
<property name="hibernate.connection.username"></property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.connection.autocommit">false</property>
<!-- Pabre connection configuration -->
<property name="connection.directory"></property> <!-- Directory where to save the embedded database -->
<property name="connection.database.name">pabreTesting</property> <!-- Database name -->
<!-- SQL dialect -->
<property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property><!-- Database connection settings -->
<property name="hibernate.connection.driver_class">org.apache.derby.jdbc.ClientDriver</property>
<property name="hibernate.connection.url">jdbc:derby://{URL}:{PORT}/{DATABASE NAME};create=true</property>
<property name="hibernate.connection.username">{USERNAME}</property>
<property name="hibernate.connection.password">{PASSWORD}</property>
<property name="hibernate.connection.autocommit">false</property>
<!-- Pabre connection configuration -->
<property name="connection.directory"></property> <!-- Directory where to save the embedded database -->
<property name="connection.database.name">pabreTesting</property> <!-- Database name -->
<!-- SQL dialect -->
<property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property><property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://{URL}:{PORT}/{DATABASE NAME}</property>
<property name="hibernate.connection.username">{USERNAME}</property>
<property name="hibernate.connection.password">{PASSWORD}</property>
<property name="hibernate.connection.autocommit">false</property>
<!-- Pabre connection configuration -->
<property name="connection.directory"></property> <!-- Directory where to save the embedded database -->
<property name="connection.database.name">pabreTesting</property> <!-- Database name -->
<!-- SQL dialect -->
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property><property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://{URL}:{PORT}/{Database name}</property>
<property name="hibernate.connection.username">{USERNAME}</property>
<property name="hibernate.connection.password">{PASSWORD}</property>
<property name="hibernate.connection.autocommit">false</property>
<!-- Pabre connection configuration -->
<property name="connection.directory"></property> <!-- Directory where to save the embedded database -->
<property name="connection.database.name">pabreTesting</property> <!-- Database name -->
<!-- SQL dialect -->
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
- https://www.upc.edu/gessi/PABRE/index.html
- https://re-magazine.ireb.org/articles/requirements-reuse
- https://www.iso.org/standard/22749.html
See OpenReq project contribution guidelines
Free use of this software is granted under the terms of the EPL version 2 (EPL2.0)