|
2 | 2 | [](https://isaacmaffeis.github.io/javaToAvalla/javadoc/)
|
3 | 3 | [](https://github.com/isaacmaffeis/javaToAvalla/actions/workflows/maven.yml)
|
4 | 4 | [](https://github.com/isaacmaffeis/javaToAvalla/actions/workflows/docker-image.yml)
|
| 5 | +<!-- |
5 | 6 | [](https://github.com/isaacmaffeis/javaToAvalla/actions/workflows/pages/pages-build-deployment)
|
| 7 | +--> |
| 8 | + |
| 9 | +**JavaToAvalla** is a tool that allows you to automatically convert a Junit scenario into an avalla language one. |
| 10 | +This tool was developed with the aim of simplifying the testing procedure of an Abstract State Machine (ASM), |
| 11 | +and is part of the [evoAvalla](https://github.com/isaacmaffeis/evoAvalla) project. |
| 12 | + |
| 13 | +## How to start |
| 14 | + |
| 15 | +To use **JavaToAvalla**, you have two options: you can run it using **Maven** or **Docker Compose**: |
| 16 | + |
| 17 | +### - Running with Maven: |
| 18 | + |
| 19 | +If you prefer to run the application directly using Maven, make sure you have installed: |
| 20 | + |
| 21 | + - Java 8 |
| 22 | + - Maven 3+ |
| 23 | + |
| 24 | +and follow these steps: |
| 25 | + |
| 26 | +1. **Clone the Repository**: |
| 27 | + |
| 28 | + Start by cloning the repository, open a terminal and digit: |
| 29 | + |
| 30 | + ```shell |
| 31 | + git clone https://github.com/isaacmaffeis/javaToAvalla.git |
| 32 | + ``` |
| 33 | + |
| 34 | + and navigate to the root of the cloned repository folder: |
| 35 | + ```shell |
| 36 | + cd path/to/cloned/repository |
| 37 | + ``` |
| 38 | + |
| 39 | + |
| 40 | +2. **Build the Project**: |
| 41 | + |
| 42 | + Use Maven to build the project: |
| 43 | + ```shell |
| 44 | + mvn clean package |
| 45 | + ``` |
| 46 | + |
| 47 | +3. **Run the Application**: |
| 48 | + |
| 49 | + You can run the application using the following command: |
| 50 | + ```shell |
| 51 | + java -jar .\target\javatoavalla-1.0-SNAPSHOT-jar-with-dependencies.jar -help |
| 52 | + ``` |
| 53 | + |
| 54 | +### - Running with Docker Compose: |
| 55 | + |
| 56 | +If you want to use Docker Compose, you need to have [Docker Desktop](https://www.docker.com/products/docker-desktop) |
| 57 | +installed and running on your pc, then you can pull the image from the dockerhub and use Docker Compose to run it. |
| 58 | + |
| 59 | +1. **Create a docker-compose.yml file:** |
| 60 | + |
| 61 | + In the project root directory, create a `docker-compose.yml` file and add: |
| 62 | + |
| 63 | + ```yml |
| 64 | + version: '3' |
| 65 | + services: |
| 66 | + javatoavalla: |
| 67 | + build: |
| 68 | + context: . |
| 69 | + dockerfile: Dockerfile |
| 70 | + image: isaacmaffeis/javatoavalla:latest |
| 71 | + volumes: |
| 72 | + - ./input:/app/input |
| 73 | + - ./output:/app/output |
| 74 | + ``` |
| 75 | + |
| 76 | +2. **Run the Application:** |
| 77 | +
|
| 78 | + To start the application with Docker Compose, run: |
| 79 | + ```shell |
| 80 | + docker compose pull |
| 81 | + ``` |
| 82 | + to pull the latest Docker images for the services defined in the `docker-compose.yml` file from the Docker Hub. |
| 83 | + Then run: |
| 84 | + ```shell |
| 85 | + docker compose up |
| 86 | + ``` |
| 87 | + to Builds and starts the containers defined in the docker-compose.yml file. |
| 88 | + And finally: |
| 89 | + ```shell |
| 90 | + docker compose run --rm javatoavalla -help |
| 91 | + ``` |
| 92 | + to run the one-time specified command into the container (--rm : removes automatically the container once the command has completed.): |
| 93 | + |
| 94 | +## Usage |
| 95 | + |
| 96 | +After building the project, you can use it with the following command-line options: |
| 97 | + |
| 98 | +### Command-Line Options |
| 99 | + |
| 100 | +| Option | Argument Type | Description | |
| 101 | +|--------------------|-------------------|-----------------------------------------------------------------------------| |
| 102 | +| `-help` | None | Prints the help message with a description of available options. | |
| 103 | +| `-input` | String (required) | Path to the Java input file. | |
| 104 | +| `-stepFunctionArgs`| String (optional) | Path to the `stepFunctionArgs.txt` file. Defaults to `./input/stepFunctionArgs.txt`.| |
| 105 | +| `-output` | String (optional) | Specifies the output folder. Defaults to `./output/`. | |
| 106 | +| `-clean` | Boolean (optional)| Cleans the input and stepFunctionArgs files after the process. | |
| 107 | + |
| 108 | +#### example |
| 109 | + |
| 110 | +Below there is an example of a typically used command: |
| 111 | + |
| 112 | +with Maven: |
| 113 | +```shell |
| 114 | +java -jar .\target\javatoavalla-1.0-SNAPSHOT-jar-with-dependencies.jar -input "./input/exampleScenario.java" -clean true |
| 115 | +``` |
| 116 | +with Docker Compose: |
| 117 | +```shell |
| 118 | +docker compose run --rm javatoavalla -input "./input/exampleScenario.java" -clean true |
| 119 | +``` |
| 120 | + |
| 121 | +## Repository Structure |
| 122 | +The project repository is organized into the following folders: |
| 123 | + |
| 124 | +- `input/`: The application expects .java input files to be placed here before execution. |
| 125 | + |
| 126 | +- `output/`: The output .avalla files generated by the services will be located here. |
| 127 | + |
| 128 | +- `src/`: The main source code of the project. |
| 129 | + |
| 130 | +- `.github/workflows/`: Contains the YAML files that define workflows for continuous integration (CI) and continuous deployment (CD) using GitHub Actions. |
0 commit comments