Skip to content

Commit

Permalink
v1 (#12)
Browse files Browse the repository at this point in the history
* updated build to produce javadoc and sources jars
* included LICENSE metadata
* small fixes for continuity
Signed-off-by: Jeff Nickoloff <[email protected]>
  • Loading branch information
allingeek authored Sep 26, 2023
1 parent 0d49e5b commit a587d32
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
16 changes: 14 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ plugins {
}

group 'com.gremlin'
version '0.2-SNAPSHOT'
version '1.0'

repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}

java {
withSourcesJar()
withJavadocJar()
}


dependencies {
implementation 'org.yaml:snakeyaml:1.33'
implementation 'org.slf4j:slf4j-api:1.7.36'
Expand Down Expand Up @@ -39,12 +45,18 @@ publishing {
maven(MavenPublication) {
groupId = "com.gremlin"
artifactId = "failure-flags-java"
version = "0.2-SNAPSHOT"
version = "1.0"
from components.java

pom {
name = 'Failure Flags Java library'
description = 'A Java library to inject failures in your application dependencies'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/gremlin/failureflags/FailureFlag.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ public class FailureFlag {
@JsonIgnore
boolean debug;

/**
* Construct a new FailureFlag and set all options.
*
* @param name the name of the FailureFlag
* @param labels the labels of the FailureFlag
* */
public FailureFlag(String name, Map<String, String> labels) {
this.name = name;
this.labels = labels;
this.debug = false;
}
/**
* Construct a new FailureFlag and set all options.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ public Experiment[] invoke(FailureFlag flag, Behavior behavior) {
* */
@Override
public Experiment[] fetch(FailureFlag flag) {
if (!System.getenv().containsKey(FAILURE_FLAGS_ENABLED) && !this.enabled) {
return null;
}
if (flag == null) {
return null;
}
Expand All @@ -160,7 +163,6 @@ public Experiment[] fetch(FailureFlag flag) {
.uri(URI.create("http://localhost:5032/experiment"))
.header("Content-Type", "application/json")
.POST(BodyPublishers.ofString(MAPPER.writeValueAsString(flag)))
.timeout(Duration.of(150, ChronoUnit.MILLIS))
.build();

HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
Expand Down

0 comments on commit a587d32

Please sign in to comment.