JavaToAvalla is a tool that allows you to automatically convert a Junit scenario into an avalla language one. This tool was developed with the aim of simplifying the testing procedure of an Abstract State Machine (ASM), and is part of the evoAvalla project.
To use JavaToAvalla, you have two options: you can run it using Maven or Docker Compose:
If you prefer to run the application directly using Maven, make sure you have installed:
- Java 8
- Maven 3+
and follow these steps:
-
Clone the Repository:
Start by cloning the repository, open a terminal and digit:
git clone https://github.com/isaacmaffeis/javaToAvalla.git
and navigate to the root of the cloned repository folder:
cd path/to/cloned/repository
-
Build the Project:
Use Maven to build the project:
mvn clean package
-
Run the Application:
You can run the application using the following command:
java -jar .\target\javatoavalla-1.0-SNAPSHOT-jar-with-dependencies.jar -help
If you want to use Docker Compose, you need to have Docker Desktop installed and running on your pc, then you can pull the image from the dockerhub and use Docker Compose to run it.
-
Create a docker-compose.yml file:
In the project root directory, create a
docker-compose.yml
file and add:version: '3' services: javatoavalla: build: context: . dockerfile: Dockerfile image: isaacmaffeis/javatoavalla:latest volumes: - ./input:/app/input - ./output:/app/output
-
Run the Application:
To start the application with Docker Compose, run:
docker compose pull
to pull the latest Docker images for the services defined in the
docker-compose.yml
file from the Docker Hub. Then run:docker compose up
to Builds and starts the containers defined in the docker-compose.yml file. And finally:
docker compose run --rm javatoavalla -help
to run the one-time specified command into the container (--rm : removes automatically the container once the command has completed.):
After building the project, you can use it with the following command-line options:
Option | Argument Type | Description |
---|---|---|
-help |
None | Prints the help message with a description of available options. |
-input |
String (required) | Path to the Java input file. |
-stepFunctionArgs |
String (optional) | Path to the stepFunctionArgs.txt file. Defaults to ./input/stepFunctionArgs.txt . |
-output |
String (optional) | Specifies the output folder. Defaults to ./output/ . |
-clean |
Boolean (optional) | Cleans the input and stepFunctionArgs files after the process. |
Below there is an example of a typically used command:
with Maven:
java -jar .\target\javatoavalla-1.0-SNAPSHOT-jar-with-dependencies.jar -input "./input/exampleScenario.java" -clean true
with Docker Compose:
docker compose run --rm javatoavalla -input "./input/exampleScenario.java" -clean true
The project repository is organized into the following folders:
-
input/
: The application expects .java input files to be placed here before execution. -
output/
: The output .avalla files generated by the services will be located here. -
src/
: The main source code of the project. -
.github/workflows/
: Contains the YAML files that define workflows for continuous integration (CI) and continuous deployment (CD) using GitHub Actions.