Shields4J

Libraries for generation badges using the service shields.io

License

License

GroupId

GroupId

org.touchbit.shields4j
ArtifactId

ArtifactId

shields4j-parent
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

pom
Description

Description

Shields4J
Libraries for generation badges using the service shields.io
Project URL

Project URL

https://github.com/touchbit/shields4j
Project Organization

Project Organization

TouchBIT
Source Code Management

Source Code Management

https://github.com/touchbit/shields4j

Download shields4j-parent

Filename Size
shields4j-parent-1.0.1.pom 12 KB
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/org.touchbit.shields4j/shields4j-parent/ -->
<dependency>
    <groupId>org.touchbit.shields4j</groupId>
    <artifactId>shields4j-parent</artifactId>
    <version>1.0.1</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/org.touchbit.shields4j/shields4j-parent/
implementation 'org.touchbit.shields4j:shields4j-parent:1.0.1'
// https://jarcasting.com/artifacts/org.touchbit.shields4j/shields4j-parent/
implementation ("org.touchbit.shields4j:shields4j-parent:1.0.1")
'org.touchbit.shields4j:shields4j-parent:pom:1.0.1'
<dependency org="org.touchbit.shields4j" name="shields4j-parent" rev="1.0.1">
  <artifact name="shields4j-parent" type="pom" />
</dependency>
@Grapes(
@Grab(group='org.touchbit.shields4j', module='shields4j-parent', version='1.0.1')
)
libraryDependencies += "org.touchbit.shields4j" % "shields4j-parent" % "1.0.1"
[org.touchbit.shields4j/shields4j-parent "1.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.25

Project Modules

  • client
  • testng
  • test-core

Shields4j Master MavenCentral DocumentationStatus AlertStatus Coverage

Lightweight java HTTP-client for the shields.io service.

Full documentation is available on the shields4j.readthedocs.io

Briefly

Java client

Add dependency

<dependency>
    <groupId>org.touchbit.shields4j</groupId>
    <artifactId>client</artifactId>
    <version>${shields4j.version}</version>
</dependency>

If you need to get Shields4j versions that are not uploaded to maven central (snapshot/staging), add the Sonatype repository to your pom.xml

<repositories>
    <repository>
        <id>SonatypeNexus</id>
        <url>https://oss.sonatype.org/content/groups/staging/</url>
    </repository>
</repositories>

Minimal minimal

class Example {
    public static void main (String[] arg) {
        new ShieldsIO()
            .withLabel("Shields4J")
            .withMessage("1.0")
            .writeShieldToFile("minimal.svg");
    }
}

With logo and color background withlogo

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

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

<dependency>
    <groupId>org.touchbit.shields4j</groupId>
    <artifactId>testng</artifactId>
    <version>${shields4j.version}</version>
</dependency>

Add IShieldsListener to testNG iteststotal itestssuccesspercent

class Example {
    public static void main (String[] arg) {
         TestNG testNG = new TestNG();
         testNG.addListener(new IShieldsListener());
    }
}

or add IShieldsListener in your testng.xml file

<suite>
  <listeners>
    <listener class-name="org.touchbit.shields4j.testng.IShieldsListener" />
  </listeners>
</suite>

To customize the prefixes, create your own listener inherited from IShieldsListener integrationtesttotal integrationtestsuccesspercent

public class ShieldsListener extends IShieldsListener {
    public ShieldsListener() {
        withLabelPefix("Integration test");
        withFilePefix("testng");
    }
}
org.touchbit.shields4j

TouchBIT

Projects are mirrored from https://gitlab.com/TouchBIT

Versions

Version
1.0.1
1.0.0