Skip to content

About

This repository serves as a pilot backend implementation to demonstrate the integrated Explore and study page feature.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Codacy Badge

Bento Backend Framework Configuration Guide

This is the user documentation for the Bento Backend.

Introduction

The Bento Backend Framework is a server-side backend written in Java to be used with Bento based applications. The Bento Backend is meant to be used in conjunction with the Bento Frontend Framework and a Neo4j database running the GraphQL plugin.

The Bento Backend can be found in this Github Repository: Bento Backend

Pre-requisites

  • Java 17 or newer installed on the server hosting the Bento Backend
  • The Neo4j database containing the Bento data has been initialized and is running

Running Unit Tests Locally

This project uses Maven and JUnit for unit tests. Unit tests are located under src/test/java.

Run with local Java and Maven

Install JDK 17 and Maven 3.9 or newer, then run commands from the repository root:

mvn clean test -Dspring.profiles.active=test

Run a single test class:

mvn -Dtest=gov.nih.nci.bento_ri.util.ValueUtilsTest test

Run a single test method:

mvn -Dtest=gov.nih.nci.bento_ri.util.ValueUtilsTest#toStringListConvertsListValuesAndRemovesNulls test

Note: use mvn directly unless the Maven wrapper metadata exists under .mvn/wrapper. The wrapper scripts require those files to run reliably.

Run with Docker

If Java or Maven is not installed locally, run tests in a Maven/JDK container:

docker run --rm \
  -v "$PWD:/usr/src/app" \
  -w /usr/src/app \
  maven:3.9.12-eclipse-temurin-17 \
  mvn -Dtest=gov.nih.nci.bento_ri.util.ValueUtilsTest test

To run the full unit test suite in Docker:

docker run --rm \
  -v "$PWD:/usr/src/app" \
  -w /usr/src/app \
  maven:3.9.12-eclipse-temurin-17 \
  mvn clean test -Dspring.profiles.active=test

NIH Network Certificate Workaround

On the NIH network, Maven dependency downloads may fail inside Docker with a Java certificate error like PKIX path building failed. This means the container JVM does not trust the local NIH certificate chain. For a disposable test container, extract the certificate chain and import it into the container truststore before running Maven.

Configuration

The following file will need to be edited to configure the Bento Backend Code to work within a Bento based application:

src/main/resources/application.properties

  1. create this file by creating a copy of src/main/resources/application_example.properties and renaming it to use as a starting point.
  2. Line 2 - change the value of neo4j.graphql.endpoint to the GraphQL endpoint running on the applications Neo4j database.
  3. Line 4 - change the value of graphql.schema to the path of the GraphQL schema file that will be uploaded to the database. The file path should be relative to the main folder in the project.
  4. Line 5 - change the value of neo4j.authorization to the basic access authentication for your Neo4j database. (See the Basic Access Authentication section for instructions on how to generate this value).
  5. Line 9 - this value is an all lowercase Boolean value to determine if GraphQL queries will be enabled for the application.
  6. Line 10 - this value is an all lowercase Boolean value to determine if GraphQL mutations will be enabled for the application.

Basic Access Authentication

The basic access authentication value used in the application.properties file is of the form Basic <base64 encoding of username:password>. To generate this value generate the base64 encoding of the username and password as shown below and append that to the String “Basic “. a

Example

  • Username:neo4j
  • Password:my_password
  • Authorization Value:Basic bmVvNGo6bXlfcGFzc3dvcmQ=

Generate base64 encoding in terminal/bash

echo -n "neo4j:my_password" | base64

Generate base64 encoding in powershell

[Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("neo4j:my_password"))

About

This repository serves as a pilot backend implementation to demonstrate the integrated Explore and study page feature.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages