Skip to main content

Offline or local installation of PTF

It is possible to run Policy Testing Framework in (PTF) offline mode (air-gapped mode) or in local mode.

  • In offline-mode no network connection is required.
  • In local-mode, only Intranet (corporate) network is utilized, and internet access is not required.

Offline or local mode could be a solution when your corporate network is restricted and does not allow you to freely download files from the public Internet.

Normally PTF download libraries (jar-files) from Maven central (https://repo.maven.apache.org) and Axiomatics Maven (S3 bucket). If you are unable to download content from these servers, you can instead pre-download a copy of the Maven repository and copy it into your ALFA project or install it in your software/artifact server. In this way the dependency on a internet connection is removed and the only requirement is an installed Java. Follow these steps to run PTF in offline or local mode.

Configuring PTF for offline mode

Installation of PTF in offline mode

  1. On a computer with unrestricted internet access and Git installed, clone the PTF Git repo by executing git clone https://github.com/axiomatics/policy-testing-framework, then copy the cloned repo to target machine. You can also download a clone as an archive from GitHub via the following link https://github.com/axiomatics/policy-testing-framework/archive/refs/heads/main.zip. If you have no computer with unrestricted internet access or Git, state so to Axiomatics in next step and you will receive it as part of the deliverable.

  2. Contact Axiomatics via support portal and provide details how you want the Maven repository clone delivered. For example if you have a secure 3rd party file share service or want a HTTPS download link (for download on a computer without restrictions and then manually transfer to target computer). The repository clone is a ZIP file around 250 MB that contains jar and pom files).

  3. Copy the content of the ZIP file into the root of your ALFA git project. If you are prompted to overwrite one file (gradle-wrapper.properties) select Overwrite or Yes.

  4. Verify the changes:

    • ALFA_PROJECT_ROOT/lib/ exists and contains the local Maven repo (ie has subfolders com, org, ... )
    • ALFA_PROJECT_ROOT/gradle/wrapper/gradle-7.x.y-bin.zip exists
    • In file ALFA_PROJECT_ROOT/gradle/wrapper/gradle-wrapper.properties the key distributionUrl no longer points to a HTTPS URL but to a local file (gradle-7.x.y-bin.zip)
  5. Verify PTF runs in offline mode by executing a task, for example gradlew test. You should see the following output: Running in offline mode using local repository at $PATH/alfa-test-framework\lib

  6. Delete the zip file if you copied it into the project directory prior to unzipping, so you don't accidentally commit it to the repository.

  7. Now you have a functional offline installation and can continue with Getting started.

Running PTF in offline mode

There is no difference how to run PTF in offline mode compared to online mode, once you have configured it for offline mode.

Committing offline mode changes

Once question you should ask yourself, should you commit the changes to the Git repo after you have configured it for offline mode? If you commit the changes, your ALFA git repo will hereafter contain binaries and grow with around 250 mb. This is against best practices of how Git should be used. It can also affect performance of your central build server, when 250 mb of data needs to be checkedout every time you build.

Try to avoid committing the offline mode changes (insted add them to .gitignore ), and instead try to run PTF in local mode. If you have no other choice than to commit the offline mode changes, it is fine to do so.

Local mode

Instead of configuring PTF in offline mode, you can run it in local mode. Local mode means internet access is not required but intranet (corporate) network access is instead used and your software/artifact server (Artifactory, Nexus etc.) is used to host and download the jar files. Contact your team responsible for your software repository server and ask them to import the Axiomatics Maven clone you have obtained from Axiomatics. Then reconfigure the PTF Gradle project and add your corporate repositories. There are two repository sections that needs to be updated in PTF. One in buildSrc/build.gradle and one in buildSrc/src/main/groovy/alfa-testing-framework.gradle. Add your corporate repository first in the repositories { sections. Exactly how your repository is added is specific to your organization and if you need guidance you need to seek support internally within your organization.

It is also possible to distribute the Gradle distribution via a local software server in the same way. Publish the gradle distribution in your software server and update gradle/wrapper/gradle-wrapper.properties accordingly by pointing the distributionUrl to your software server.

Upgrading and maintaining

If you upgrade PTF (either by executing git pull or modifying PTF in other ways), it might be needed to either request and install a new version of the offline maven library from Axiomatics or add necessary files in the lib/ manually folder yourself.

If you add files manually to lib/ folder, they need to adhere to the standard Maven respiratory format.

Support

See Contacting Axiomatics .