GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - microcks/microcks-java-client: Java client for accessing and using Microcks API

BranchesTags
Open more actions menu

Latest commit

 

History

186 Commits
186 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
api
api
 
 
src
src
 
 
.gitignore
.gitignore
 
 
ADOPTERS.md
ADOPTERS.md
 
 
AI-POLICY.md
AI-POLICY.md
 
 
BACKERS.md
BACKERS.md
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
DEPENDENCY_POLICY.md
DEPENDENCY_POLICY.md
 
 
GOVERNANCE.md
GOVERNANCE.md
 
 
LICENSE
LICENSE
 
 
MAINTAINERS.md
MAINTAINERS.md
 
 
README.md
README.md
 
 
ROADMAP.md
ROADMAP.md
 
 
SECURITY-INSIGHTS.yml
SECURITY-INSIGHTS.yml
 
 
SECURITY.md
SECURITY.md
 
 
jreleaser.yml
jreleaser.yml
 
 
pom.xml
pom.xml
 
 

Repository files navigation

Microcks Java Client

A Java Client or SDK that allows you to interact with the Microcks API. It has minimal dependencies and is easy to use.

GitHub Workflow Status Version License Project Chat Artifact HUB CNCF Landscape

Build Status

Latest released version is 0.0.8.

Current development version is 0.0.9-SNAPSHOT.

Fossa license and security scans

FOSSA Status FOSSA Status FOSSA Status

OpenSSF best practices on Microcks core

CII Best Practices OpenSSF Scorecard

Community

  • Documentation
  • Microcks Community and community meeting
  • Join us on Discord, on GitHub Discussions or CNCF Slack #microcks channel

To get involved with our community, please make sure you are familiar with the project's Code of Conduct.

Versions

Java Client Microcks Version
0.0.x 1.10.0 and +

How to use it?

Include it into your project dependencies

If you're using Maven:

<dependency>
  <groupId>io.github.microcks</groupId>
  <artifactId>microcks-java-client</artifactId>
  <version>0.0.8</version>
</dependency>

or if you're using Gradle:

dependencies {
    implementation 'io.github.microcks:microcks-java-client:0.0.8'
}

Use it in your code

The API endpoints available on Microcks backend are split in different classes in the io.github.microcks.client package. Each class represents a different part of the API but needs a common client configuration that is named ApiClient.

Here's the basic usage of the client where you configure the base URI of the Microcks API:

ApiClient apiClient = new ApiClient();
apiClient.updateBaseUri("http://localhost:8585/api");

You can then easily use the client to interact with the different part of the API:

ConfigApi configApi = new ConfigApi(apiClient);
KeycloakConfig config = configApi.getKeycloakConfig();

Check the Microcks' OpenAPI reference for comprehensive list of available endpoints and their parameters.

Access to authenticated endpoints

If your Microcks backend instance has enabled AuthN and AUthZ and if you need to access authenticated endpoints, we provide a KeycloakClient to first retrieve an oAuth token to use in following requests. You'll additionally need the service account name and credentials to retrieve the token (see our documentation on how Microcks is using Service Accounts).

The flow is as follows:

KeycloakConfig keycloak = configApi.getKeycloakConfig();

// If Keycloak is enabled on target backend.
if (config.isEnabled()) {
   // Build the OAuth token endpoint - here using Keycloak public url but it could be another private one.
   String tokenEndpoint = keycloak.getAuthServerUrl() + "/realms/" + keycloak.getRealm() + "/protocol/openid-connect/token";
   final String oauthToken = KeycloakClient.connectAndGetOAuthToken("<service-account>", "<service-account-credentials>", tokenEndpoint);
   
   // Set a new interceptor to add the Authorization header with the OAuth token.
   apiClient.setRequestInterceptor(request -> request.header("Authorization", "Bearer " + oauthToken));
}

// Now you can use the client to create a protected resource.
JobApi jobApi = new JobApi(apiClient);

ImportJob importJob = new ImportJob();
importJob.setName("Hello Soap Service");
importJob.setRepositoryUrl("https://raw.githubusercontent.com/microcks/microcks/master/samples/HelloService-soapui-project.xml");

ImportJob result = jobApi.createImportJob(importJob);

About

Java client for accessing and using Microcks API

microcks.io

Topics

api-clientcontract-testingjavamicrocksmocking

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

7 stars

Watchers

3 watching

Forks

2 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.