Skip to content

Latest commit

 

History

History
264 lines (178 loc) · 9.55 KB

File metadata and controls

264 lines (178 loc) · 9.55 KB

System tests

The system tests copies a file from a provider to a consumer blob storage account.

Publish/Build Tasks

! Important Note !

MVD depends on Eclipse DataSpaceConnector(EDC), Identity Hub and Registration Service. These dependencies are not published to any central artifact repository yet, so in local development we have to use locally published dependencies.

In order to use the correct version of each repo required by the MVD, you need to look in action.yml for the hashes of the versions of the EDC, Identity Hub and the Registration Service that are being used by the MVD.

For Example for the dependency repositories:

  • Registration Service
  • Identity Hub
  • EDC

the hash (which is subject to change from the values presented here as an example) can be found in the Checkout steps (in the ref property) of action.yml:

    - name: Checkout EDC
      uses: actions/checkout@v2
      with:
        repository: eclipse-dataspaceconnector/DataSpaceConnector
        path: DataSpaceConnector
        ref: 3ff940b720f44826df28e893fb31344eb6faacef

    - name: Checkout Registration Service
      uses: actions/checkout@v2
      with:
        repository: eclipse-dataspaceconnector/RegistrationService
        path: RegistrationService
        ref: 374c14bcca23ddb1dcd7476a27264510e54de7fa

    - name: Checkout Identity Hub
      uses: actions/checkout@v2
      with:
        repository: eclipse-dataspaceconnector/IdentityHub
        path: IdentityHub
        ref: bc13cf0cb8589b792eef733c7cf7b3422476add5

After you have cloned the EDC, Identity Hub and Registration Service repos locally you should run the command to checkout to the specific hash.

For Example:

# EDC (in the EDC root folder)
git checkout 3ff940b720f44826df28e893fb31344eb6faacef

# Identity Hub (in the Identity Hub root folder)
git checkout bc13cf0cb8589b792eef733c7cf7b3422476add5

# Registration Service (in the Registration Service root folder)
git checkout 374c14bcca23ddb1dcd7476a27264510e54de7fa

Now you can follow the rest of the process below.
Once the publications are available in Maven Central this process will not be necessary


EDC


Execute the following command from EDC root folder.

./gradlew publishToMavenLocal -P "skip.signing"

Identity Hub


Execute the following command from Identity Hub root folder:

./gradlew publishToMavenLocal -P "skip.signing"

Registration Service


Execute the following command from Registration Service root folder:

./gradlew publishToMavenLocal

MVD


Now that the publishing to the local repositories has been completed, MVD can be built by running the following command from the root of the MVD project folder:

./gradlew build -x test

Local Test Execution

  • MVD system tests can be executed locally against a local MVD instance.
  • MVD runs three EDC Connectors and one Registration Service.

Note: Ensure that you are able to build MVD locally as described in the previous section.

First, we need to build the EDC Connector (which also includes the Identity Hub) and Registration Service runtimes. As we are running MVD locally, we include useFsVault to indicate that the system will be using the local file-system based key vault.

From the MVD root folder, execute the following command:

./gradlew -DuseFsVault="true" :launcher:shadowJar

From the Registration Service root folder, execute the following command:

./gradlew :launcher:shadowJar

From the MVD root folder execute the following commands to set the Registration Launcher path environment variable and start MVD using the docker-compose.yml file.

Note that the value of the path is relative to the build system and is only here for example. You will need to change this

export REGISTRATION_SERVICE_LAUNCHER_PATH=/path/to/your/RegistrationService/launcher
docker-compose -f system-tests/docker-compose.yml up --build

Note for Windows PowerShell, the following commands should be used from the MVD project root. (The path will depend on the location of the your RegistrationService project root):

$Env:REGISTRATION_SERVICE_LAUNCHER_PATH="c:/RegistrationService/launcher"
docker-compose -f system-tests/docker-compose.yml up --build

Once completed, following services will start within their docker containers:

  • 3 EDC Connectors
    • consumer-us
    • consumer-eu
    • provider (which will also be seeded with initial required data using a postman collection)
  • A Registration Service
  • A HTTP Nginx Server (to serve DID Documents)
  • An Azurite blob storage service

Note, the Newman docker container will automatically stop after seeding initial data from postman scripts.

EDC Connectors need to be registered using Registration Service CLI client jar. After publishing Registration Service locally the client jar should be available under the Registration Service root project folder in client-cli/build/libs.

Note that the value of the path is relative to the build system and is only here for example.

# Replace path according to your local set up
export REGISTRATION_SERVICE_CLI_JAR_PATH=c:/RegistrationService/client-cli/build/libs/registration-service-cli.jar

# Register Participants
./system-tests/resources/register-participants.sh

Note for Windows PowerShell, the following commands should be run the the MVD root project folder.

# Replace path according to your local set up

$Env:REGISTRATION_SERVICE_CLI_JAR_PATH = "c:\RegistrationService\client-cli\build\libs\registration-service-cli.jar"

# Register Provider
java -jar $Env:REGISTRATION_SERVICE_CLI_JAR_PATH -s="http://localhost:8184/api" participants add --request="{ \`"name\`": \`"provider\`", \`"supportedProtocols\`": [ \`"ids-multipart\`" ], \`"url\`": \`"http://provider:8282\`" }"

# Register Consumer-EU
java -jar $Env:REGISTRATION_SERVICE_CLI_JAR_PATH -s="http://localhost:8184/api" participants add --request="{ \`"name\`": \`"consumer-eu\`", \`"supportedProtocols\`": [ \`"ids-multipart\`" ], \`"url\`": \`"http://consumer-eu:8282\`" }"

# Register Consumer-US
java -jar $Env:REGISTRATION_SERVICE_CLI_JAR_PATH -s="http://localhost:8184/api" participants add --request="{ \`"name\`": \`"consumer-us\`", \`"supportedProtocols\`": [ \`"ids-multipart\`" ], \`"url\`": \`"http://consumer-us:8282\`" }"

Set the environment variable TEST_ENVIRONMENT to local to enable local blob transfer test and then run MVD system test using the following command:

export TEST_ENVIRONMENT=local
./gradlew :system-tests:test

Note for Windows PowerShell, the following commands should be used:

$Env:TEST_ENVIRONMENT = "local"
./gradlew :system-tests:test

Storage Explorer can be used to connect to the Azurite storage container on 127.0.0.1:10000 port and under the consumereuassets account, the transferred blob can be viewed.

Local Test Resources

The following test resources are provided in order to run MVD locally. system-tests/docker-compose.yml uses it to start MVD.




Each EDC Connector has its own set of Private and Public keys in PEM and Java KeyStore formats, e.g. system-tests/resources/vault/provider. These were generated using the following commands:

# generate a private key
openssl ecparam -name prime256v1 -genkey -noout -out private-key.pem
# generate corresponding public key
openssl ec -in private-key.pem -pubout -out public-key.pem
# create a self-signed certificate
openssl req -new -x509 -key private-key.pem -out cert.pem -days 360

Generated keys are imported to keystores e.g. system-tests/resources/vault/provider/provider-keystore.jks. Each keystore has password test123.

KeyStore Explorer can be used to manage keystores from UI.

MVD local instances use a file-system based vault and its keys are managed using a java properties file e.g.system-tests/resources/vault/provider/provider-vault.properties.

! IMPORTANT !

File System Vault is NOT a secure vault and thus should only be used for testing purposes




Web DIDs are available under system-tests/resources/webdid folder. The publicKeyJwk section of each did.json was generated by converting the corresponding public key to JWK format, for example provider connector public key was converted to JWK using following command:

docker run -i danedmunds/pem-to-jwk:1.2.1 --public --pretty < system-tests/resources/vault/provider/public-key.pem > key.public.jwk



Debugging MVD locally

Follow the instructions in the previous sections to run an MVD with a consumer and provider locally using docker-compose.

Once running, you can use a Java debugger to connect to the consumer (port 5006) and provider (port 5005) instances. If you are using IntelliJ you can use the provided "EDC consumer" or "EDC provider" runtime configurations to remote debug the connector instances.

Issuing requests manually with Postman

A postman collection can be used to issue requests to an MVD instance of your choice. You will need to adapt the environment variables accordingly to match your target MVD instance.