https://github.com/touchbit/shields4j
Java client for shields.io
https://github.com/touchbit/shields4j
java shields4j shieldsio shieldsio-client testng testng-listners
Last synced: 30 days ago
JSON representation
Java client for shields.io
- Host: GitHub
- URL: https://github.com/touchbit/shields4j
- Owner: touchbit
- License: mit
- Created: 2019-04-15T07:46:03.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-12-14T20:37:48.000Z (about 4 years ago)
- Last Synced: 2025-07-07T16:03:51.878Z (7 months ago)
- Topics: java, shields4j, shieldsio, shieldsio-client, testng, testng-listners
- Language: Java
- Homepage: https://shields.io
- Size: 166 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.rst
Awesome Lists containing this project
README
Shields4j |Master| |MavenCentral| |DocumentationStatus| |AlertStatus| |Coverage|
=======================================
.. |Master| image:: https://github.com/touchbit/shields4j/workflows/Master/badge.svg?style=plastic
:target: https://github.com/touchbit/shields4j/actions?query=workflow%3Amaster
.. |MavenCentral| image:: https://maven-badges.herokuapp.com/maven-central/org.touchbit.shields4j/shields4j-parent/badge.svg
:target: https://mvnrepository.com/artifact/org.touchbit.shields4j
.. |DocumentationStatus| image:: https://readthedocs.org/projects/shields4j/badge/?version=master
:target: https://shields4j.readthedocs.io
.. |AlertStatus| image:: https://sonarcloud.io/api/project_badges/measure?project=org.touchbit.shields4j%3Ashields4j-parent&metric=alert_status
:target: https://sonarcloud.io/dashboard?id=org.touchbit.shields4j%3Ashields4j-parent
.. |Coverage| image:: https://sonarcloud.io/api/project_badges/measure?project=org.touchbit.shields4j%3Ashields4j-parent&metric=coverage&blinking=true
:target: https://sonarcloud.io/component_measures?id=org.touchbit.shields4j%3Ashields4j-parent&metric=coverage
Lightweight java HTTP-client for the `shields.io`_ service.
.. _shields.io: https://shields.io/
Full documentation is available on the `shields4j.readthedocs.io`_
.. _shields4j.readthedocs.io: https://shields4j.readthedocs.io/
Briefly
-------
Java client
^^^^^^^^^^^
Add dependency
.. code:: xml
org.touchbit.shields4j
client
${shields4j.version}
If you need to get Shields4j versions that are not uploaded to maven central (snapshot/staging), add the Sonatype repository to your pom.xml
.. code:: xml
SonatypeNexus
https://oss.sonatype.org/content/groups/staging/
Minimal |minimal|
.. |minimal| image:: .docs/img/minimal.svg
.. code:: java
class Example {
public static void main (String[] arg) {
new ShieldsIO()
.withLabel("Shields4J")
.withMessage("1.0")
.writeShieldToFile("minimal.svg");
}
}
With logo and color background |withlogo|
.. |withlogo| image:: .docs/img/with-logo.svg
.. code:: java
class Example {
public static void main (String[] arg) {
new ShieldsIO()
.withLabel("Shields4J")
.withLabelColor(Color.BLUE)
.withMessage("with Raspberry PI logo")
.withMessageColor(Color.GREEN)
.withStyle(Style.POPOUT)
.withLogo(Logo.RASPBERRY_PI)
.withLogoColor(Color.RED)
.withLogoWidth(30)
.writeShieldToFile("with-logo.svg");
}
}
With custom logo and color background |withcustomlogo|
.. |withcustomlogo| image:: .docs/img/with-custom-logo.svg
.. code:: java
class Example {
public static void main (String[] arg) {
new ShieldsIO()
.withLabel("Shields4J")
.withLabelColor(Color.BLUE)
.withMessage("with custom logo")
.withMessageColor(Color.GREEN)
.withStyle(Style.POPOUT)
.withBase64Logo(new File("docs/img/status_success.svg"))
.writeShieldToFile("with-custom-logo.svg");
}
}
TestNG listener
^^^^^^^^^^^^^^^
Add dependency
.. code:: xml
org.touchbit.shields4j
testng
${shields4j.version}
Add IShieldsListener to testNG |iteststotal| |itestssuccesspercent|
.. |iteststotal| image:: .docs/img/TestNG-iTests-total.svg
.. |itestssuccesspercent| image:: .docs/img/TestNG-iTests-success-percent.svg
.. code:: java
class Example {
public static void main (String[] arg) {
TestNG testNG = new TestNG();
testNG.addListener(new IShieldsListener());
}
}
or add IShieldsListener in your testng.xml file
.. code:: xml
To customize the prefixes, create your own listener inherited from IShieldsListener |integrationtesttotal| |integrationtestsuccesspercent|
.. |integrationtesttotal| image:: .docs/img/testng-Integration-test-total.svg
.. |integrationtestsuccesspercent| image:: .docs/img/testng-Integration-test-success-percent.svg
.. code:: java
public class ShieldsListener extends IShieldsListener {
public ShieldsListener() {
withLabelPefix("Integration test");
withFilePefix("testng");
}
}