id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
117,300
jdereg/java-util
src/main/java/com/cedarsoftware/util/DeepEquals.java
DeepEquals.compareSortedMap
private static boolean compareSortedMap(SortedMap map1, SortedMap map2, Deque stack, Set visited) { // Same instance check already performed... if (map1.size() != map2.size()) { return false; } Iterator i1 = map1.entrySet().iterator(); Iterator i2 = map2...
java
private static boolean compareSortedMap(SortedMap map1, SortedMap map2, Deque stack, Set visited) { // Same instance check already performed... if (map1.size() != map2.size()) { return false; } Iterator i1 = map1.entrySet().iterator(); Iterator i2 = map2...
[ "private", "static", "boolean", "compareSortedMap", "(", "SortedMap", "map1", ",", "SortedMap", "map2", ",", "Deque", "stack", ",", "Set", "visited", ")", "{", "// Same instance check already performed...", "if", "(", "map1", ".", "size", "(", ")", "!=", "map2",...
Deeply compare two SortedMap instances. This method walks the Maps in order, taking advantage of the fact that the Maps are SortedMaps. @param map1 SortedMap one @param map2 SortedMap two @param stack add items to compare to the Stack (Stack versus recursion) @param visited Set containing items that have already been ...
[ "Deeply", "compare", "two", "SortedMap", "instances", ".", "This", "method", "walks", "the", "Maps", "in", "order", "taking", "advantage", "of", "the", "fact", "that", "the", "Maps", "are", "SortedMaps", "." ]
a2dce61aed16d6454ee575174dda1ba6bff0015c
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/DeepEquals.java#L510-L541
117,301
jdereg/java-util
src/main/java/com/cedarsoftware/util/DeepEquals.java
DeepEquals.compareFloatingPointNumbers
private static boolean compareFloatingPointNumbers(Object a, Object b, double epsilon) { double a1 = a instanceof Double ? (Double) a : (Float) a; double b1 = b instanceof Double ? (Double) b : (Float) b; return nearlyEqual(a1, b1, epsilon); }
java
private static boolean compareFloatingPointNumbers(Object a, Object b, double epsilon) { double a1 = a instanceof Double ? (Double) a : (Float) a; double b1 = b instanceof Double ? (Double) b : (Float) b; return nearlyEqual(a1, b1, epsilon); }
[ "private", "static", "boolean", "compareFloatingPointNumbers", "(", "Object", "a", ",", "Object", "b", ",", "double", "epsilon", ")", "{", "double", "a1", "=", "a", "instanceof", "Double", "?", "(", "Double", ")", "a", ":", "(", "Float", ")", "a", ";", ...
Compare if two floating point numbers are within a given range
[ "Compare", "if", "two", "floating", "point", "numbers", "are", "within", "a", "given", "range" ]
a2dce61aed16d6454ee575174dda1ba6bff0015c
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/DeepEquals.java#L636-L641
117,302
jdereg/java-util
src/main/java/com/cedarsoftware/util/SystemUtilities.java
SystemUtilities.getExternalVariable
public static String getExternalVariable(String var) { String value = System.getProperty(var); if (StringUtilities.isEmpty(value)) { value = System.getenv(var); } return StringUtilities.isEmpty(value) ? null : value; }
java
public static String getExternalVariable(String var) { String value = System.getProperty(var); if (StringUtilities.isEmpty(value)) { value = System.getenv(var); } return StringUtilities.isEmpty(value) ? null : value; }
[ "public", "static", "String", "getExternalVariable", "(", "String", "var", ")", "{", "String", "value", "=", "System", ".", "getProperty", "(", "var", ")", ";", "if", "(", "StringUtilities", ".", "isEmpty", "(", "value", ")", ")", "{", "value", "=", "Sys...
Fetch value from environment variable and if not set, then fetch from System properties. If neither available, return null. @param var String key of variable to return
[ "Fetch", "value", "from", "environment", "variable", "and", "if", "not", "set", "then", "fetch", "from", "System", "properties", ".", "If", "neither", "available", "return", "null", "." ]
a2dce61aed16d6454ee575174dda1ba6bff0015c
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/SystemUtilities.java#L32-L40
117,303
jdereg/java-util
src/main/java/com/cedarsoftware/util/Traverser.java
Traverser.walk
public void walk(Object root, Class[] skip, Visitor visitor) { Deque stack = new LinkedList(); stack.add(root); while (!stack.isEmpty()) { Object current = stack.removeFirst(); if (current == null || _objVisited.containsKey(current)) { ...
java
public void walk(Object root, Class[] skip, Visitor visitor) { Deque stack = new LinkedList(); stack.add(root); while (!stack.isEmpty()) { Object current = stack.removeFirst(); if (current == null || _objVisited.containsKey(current)) { ...
[ "public", "void", "walk", "(", "Object", "root", ",", "Class", "[", "]", "skip", ",", "Visitor", "visitor", ")", "{", "Deque", "stack", "=", "new", "LinkedList", "(", ")", ";", "stack", ".", "add", "(", "root", ")", ";", "while", "(", "!", "stack",...
Traverse the object graph referenced by the passed in root. @param root Any Java object. @param skip Set of classes to skip (ignore). Allowed to be null.
[ "Traverse", "the", "object", "graph", "referenced", "by", "the", "passed", "in", "root", "." ]
a2dce61aed16d6454ee575174dda1ba6bff0015c
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/Traverser.java#L74-L135
117,304
ryantenney/metrics-spring
src/main/java/com/ryantenney/metrics/spring/config/annotation/MetricsConfigurerAdapter.java
MetricsConfigurerAdapter.destroy
@Override public void destroy() throws Exception { if (this.reporters != null) { for (Closeable reporter : this.reporters) { try { reporter.close(); } catch (Exception ex) { LOG.warn("Problem stopping reporter", ex); } } } }
java
@Override public void destroy() throws Exception { if (this.reporters != null) { for (Closeable reporter : this.reporters) { try { reporter.close(); } catch (Exception ex) { LOG.warn("Problem stopping reporter", ex); } } } }
[ "@", "Override", "public", "void", "destroy", "(", ")", "throws", "Exception", "{", "if", "(", "this", ".", "reporters", "!=", "null", ")", "{", "for", "(", "Closeable", "reporter", ":", "this", ".", "reporters", ")", "{", "try", "{", "reporter", ".", ...
Called when the Spring context is closed, this method stops reporters.
[ "Called", "when", "the", "Spring", "context", "is", "closed", "this", "method", "stops", "reporters", "." ]
1c0803e0bee3925cdee84a8dfb5d6ff5c415b99d
https://github.com/ryantenney/metrics-spring/blob/1c0803e0bee3925cdee84a8dfb5d6ff5c415b99d/src/main/java/com/ryantenney/metrics/spring/config/annotation/MetricsConfigurerAdapter.java#L72-L84
117,305
ryantenney/metrics-spring
src/main/java/com/ryantenney/metrics/spring/config/annotation/MetricsConfigurerAdapter.java
MetricsConfigurerAdapter.registerReporter
protected <R extends Closeable> R registerReporter(final R reporter) { if (this.reporters == null) { this.reporters = new HashSet<Closeable>(); } this.reporters.add(reporter); return reporter; }
java
protected <R extends Closeable> R registerReporter(final R reporter) { if (this.reporters == null) { this.reporters = new HashSet<Closeable>(); } this.reporters.add(reporter); return reporter; }
[ "protected", "<", "R", "extends", "Closeable", ">", "R", "registerReporter", "(", "final", "R", "reporter", ")", "{", "if", "(", "this", ".", "reporters", "==", "null", ")", "{", "this", ".", "reporters", "=", "new", "HashSet", "<", "Closeable", ">", "...
Registers a reporter for destruction on Spring context close @param reporter a reporter which implements Closeable @return the reporter
[ "Registers", "a", "reporter", "for", "destruction", "on", "Spring", "context", "close" ]
1c0803e0bee3925cdee84a8dfb5d6ff5c415b99d
https://github.com/ryantenney/metrics-spring/blob/1c0803e0bee3925cdee84a8dfb5d6ff5c415b99d/src/main/java/com/ryantenney/metrics/spring/config/annotation/MetricsConfigurerAdapter.java#L91-L97
117,306
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRootValue.java
PactDslRootValue.decimalType
public static PactDslRootValue decimalType() { PactDslRootValue value = new PactDslRootValue(); value.generators.addGenerator(Category.BODY, "", new RandomDecimalGenerator(10)); value.setValue(100); value.setMatcher(new NumberTypeMatcher(NumberTypeMatcher.NumberType.DECIMAL)); return value; }
java
public static PactDslRootValue decimalType() { PactDslRootValue value = new PactDslRootValue(); value.generators.addGenerator(Category.BODY, "", new RandomDecimalGenerator(10)); value.setValue(100); value.setMatcher(new NumberTypeMatcher(NumberTypeMatcher.NumberType.DECIMAL)); return value; }
[ "public", "static", "PactDslRootValue", "decimalType", "(", ")", "{", "PactDslRootValue", "value", "=", "new", "PactDslRootValue", "(", ")", ";", "value", ".", "generators", ".", "addGenerator", "(", "Category", ".", "BODY", ",", "\"\"", ",", "new", "RandomDec...
Value that must be a decimal value
[ "Value", "that", "must", "be", "a", "decimal", "value" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRootValue.java#L341-L347
117,307
DiUS/pact-jvm
pact-jvm-consumer-junit/src/main/java/au/com/dius/pact/consumer/BaseProviderRule.java
BaseProviderRule.getPacts
protected Map<String, RequestResponsePact> getPacts(String fragment) { if (pacts == null) { pacts = new HashMap<>(); for (Method m: target.getClass().getMethods()) { if (JUnitTestSupport.conformsToSignature(m) && methodMatchesFragment(m, fragment)) { Pact pactAnno...
java
protected Map<String, RequestResponsePact> getPacts(String fragment) { if (pacts == null) { pacts = new HashMap<>(); for (Method m: target.getClass().getMethods()) { if (JUnitTestSupport.conformsToSignature(m) && methodMatchesFragment(m, fragment)) { Pact pactAnno...
[ "protected", "Map", "<", "String", ",", "RequestResponsePact", ">", "getPacts", "(", "String", "fragment", ")", "{", "if", "(", "pacts", "==", "null", ")", "{", "pacts", "=", "new", "HashMap", "<>", "(", ")", ";", "for", "(", "Method", "m", ":", "tar...
scan all methods for @Pact annotation and execute them, if not already initialized @param fragment
[ "scan", "all", "methods", "for" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-junit/src/main/java/au/com/dius/pact/consumer/BaseProviderRule.java#L177-L198
117,308
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java
PactDslRequestWithPath.matchHeader
public PactDslRequestWithPath matchHeader(String header, String regex) { return matchHeader(header, regex, new Generex(regex).random()); }
java
public PactDslRequestWithPath matchHeader(String header, String regex) { return matchHeader(header, regex, new Generex(regex).random()); }
[ "public", "PactDslRequestWithPath", "matchHeader", "(", "String", "header", ",", "String", "regex", ")", "{", "return", "matchHeader", "(", "header", ",", "regex", ",", "new", "Generex", "(", "regex", ")", ".", "random", "(", ")", ")", ";", "}" ]
Match a request header. A random example header value will be generated from the provided regular expression. @param header Header to match @param regex Regular expression to match
[ "Match", "a", "request", "header", ".", "A", "random", "example", "header", "value", "will", "be", "generated", "from", "the", "provided", "regular", "expression", "." ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java#L335-L337
117,309
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java
PactDslRequestWithPath.matchHeader
public PactDslRequestWithPath matchHeader(String header, String regex, String headerExample) { requestMatchers.addCategory("header").setRule(header, new RegexMatcher(regex)); requestHeaders.put(header, Collections.singletonList(headerExample)); return this; }
java
public PactDslRequestWithPath matchHeader(String header, String regex, String headerExample) { requestMatchers.addCategory("header").setRule(header, new RegexMatcher(regex)); requestHeaders.put(header, Collections.singletonList(headerExample)); return this; }
[ "public", "PactDslRequestWithPath", "matchHeader", "(", "String", "header", ",", "String", "regex", ",", "String", "headerExample", ")", "{", "requestMatchers", ".", "addCategory", "(", "\"header\"", ")", ".", "setRule", "(", "header", ",", "new", "RegexMatcher", ...
Match a request header. @param header Header to match @param regex Regular expression to match @param headerExample Example value to use
[ "Match", "a", "request", "header", "." ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java#L346-L350
117,310
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java
PactDslRequestWithPath.matchQuery
public PactDslRequestWithPath matchQuery(String parameter, String regex) { return matchQuery(parameter, regex, new Generex(regex).random()); }
java
public PactDslRequestWithPath matchQuery(String parameter, String regex) { return matchQuery(parameter, regex, new Generex(regex).random()); }
[ "public", "PactDslRequestWithPath", "matchQuery", "(", "String", "parameter", ",", "String", "regex", ")", "{", "return", "matchQuery", "(", "parameter", ",", "regex", ",", "new", "Generex", "(", "regex", ")", ".", "random", "(", ")", ")", ";", "}" ]
Match a query parameter with a regex. A random query parameter value will be generated from the regex. @param parameter Query parameter @param regex Regular expression to match with
[ "Match", "a", "query", "parameter", "with", "a", "regex", ".", "A", "random", "query", "parameter", "value", "will", "be", "generated", "from", "the", "regex", "." ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java#L365-L367
117,311
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java
PactDslRequestWithPath.matchQuery
public PactDslRequestWithPath matchQuery(String parameter, String regex, List<String> example) { requestMatchers.addCategory("query").addRule(parameter, new RegexMatcher(regex)); query.put(parameter, example); return this; }
java
public PactDslRequestWithPath matchQuery(String parameter, String regex, List<String> example) { requestMatchers.addCategory("query").addRule(parameter, new RegexMatcher(regex)); query.put(parameter, example); return this; }
[ "public", "PactDslRequestWithPath", "matchQuery", "(", "String", "parameter", ",", "String", "regex", ",", "List", "<", "String", ">", "example", ")", "{", "requestMatchers", ".", "addCategory", "(", "\"query\"", ")", ".", "addRule", "(", "parameter", ",", "ne...
Match a repeating query parameter with a regex. @param parameter Query parameter @param regex Regular expression to match with each element @param example Example value list to use for the query parameter (unencoded)
[ "Match", "a", "repeating", "query", "parameter", "with", "a", "regex", "." ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java#L389-L393
117,312
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonRootValue.java
PactDslJsonRootValue.decimalType
public static PactDslJsonRootValue decimalType(BigDecimal number) { PactDslJsonRootValue value = new PactDslJsonRootValue(); value.setValue(number); value.setMatcher(new NumberTypeMatcher(NumberTypeMatcher.NumberType.DECIMAL)); return value; }
java
public static PactDslJsonRootValue decimalType(BigDecimal number) { PactDslJsonRootValue value = new PactDslJsonRootValue(); value.setValue(number); value.setMatcher(new NumberTypeMatcher(NumberTypeMatcher.NumberType.DECIMAL)); return value; }
[ "public", "static", "PactDslJsonRootValue", "decimalType", "(", "BigDecimal", "number", ")", "{", "PactDslJsonRootValue", "value", "=", "new", "PactDslJsonRootValue", "(", ")", ";", "value", ".", "setValue", "(", "number", ")", ";", "value", ".", "setMatcher", "...
Value that must be a decimalType value @param number example decimalType value
[ "Value", "that", "must", "be", "a", "decimalType", "value" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonRootValue.java#L371-L376
117,313
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonRootValue.java
PactDslJsonRootValue.valueFromProviderState
public static PactDslJsonRootValue valueFromProviderState(String expression, Object example) { PactDslJsonRootValue value = new PactDslJsonRootValue(); value.generators.addGenerator(Category.BODY, "", new ProviderStateGenerator(expression)); value.setValue(example); return value; }
java
public static PactDslJsonRootValue valueFromProviderState(String expression, Object example) { PactDslJsonRootValue value = new PactDslJsonRootValue(); value.generators.addGenerator(Category.BODY, "", new ProviderStateGenerator(expression)); value.setValue(example); return value; }
[ "public", "static", "PactDslJsonRootValue", "valueFromProviderState", "(", "String", "expression", ",", "Object", "example", ")", "{", "PactDslJsonRootValue", "value", "=", "new", "PactDslJsonRootValue", "(", ")", ";", "value", ".", "generators", ".", "addGenerator", ...
Adds a value that will have it's value injected from the provider state @param expression Expression to be evaluated from the provider state @param example Example value to be used in the consumer test
[ "Adds", "a", "value", "that", "will", "have", "it", "s", "value", "injected", "from", "the", "provider", "state" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonRootValue.java#L806-L811
117,314
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslJsonArray.java
LambdaDslJsonArray.minArrayLike
public LambdaDslJsonArray minArrayLike(Integer size, Consumer<LambdaDslJsonBody> nestedObject) { final PactDslJsonBody arrayLike = pactArray.minArrayLike(size); final LambdaDslJsonBody dslBody = new LambdaDslJsonBody(arrayLike); nestedObject.accept(dslBody); arrayLike.closeArray(); ...
java
public LambdaDslJsonArray minArrayLike(Integer size, Consumer<LambdaDslJsonBody> nestedObject) { final PactDslJsonBody arrayLike = pactArray.minArrayLike(size); final LambdaDslJsonBody dslBody = new LambdaDslJsonBody(arrayLike); nestedObject.accept(dslBody); arrayLike.closeArray(); ...
[ "public", "LambdaDslJsonArray", "minArrayLike", "(", "Integer", "size", ",", "Consumer", "<", "LambdaDslJsonBody", ">", "nestedObject", ")", "{", "final", "PactDslJsonBody", "arrayLike", "=", "pactArray", ".", "minArrayLike", "(", "size", ")", ";", "final", "Lambd...
Element that is an array with a minimum size where each item must match the following example @param size minimum size of the array
[ "Element", "that", "is", "an", "array", "with", "a", "minimum", "size", "where", "each", "item", "must", "match", "the", "following", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslJsonArray.java#L313-L319
117,315
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslJsonArray.java
LambdaDslJsonArray.minMaxArrayLike
public LambdaDslJsonArray minMaxArrayLike(Integer minSize, Integer maxSize, Consumer<LambdaDslJsonBody> nestedObject) { final PactDslJsonBody arrayLike = pactArray.minMaxArrayLike(minSize, maxSize); final LambdaDslJsonBody dslBody = new LambdaDslJsonBody(arrayLike); nestedObject.accept(dslBody); arrayLi...
java
public LambdaDslJsonArray minMaxArrayLike(Integer minSize, Integer maxSize, Consumer<LambdaDslJsonBody> nestedObject) { final PactDslJsonBody arrayLike = pactArray.minMaxArrayLike(minSize, maxSize); final LambdaDslJsonBody dslBody = new LambdaDslJsonBody(arrayLike); nestedObject.accept(dslBody); arrayLi...
[ "public", "LambdaDslJsonArray", "minMaxArrayLike", "(", "Integer", "minSize", ",", "Integer", "maxSize", ",", "Consumer", "<", "LambdaDslJsonBody", ">", "nestedObject", ")", "{", "final", "PactDslJsonBody", "arrayLike", "=", "pactArray", ".", "minMaxArrayLike", "(", ...
Element that is an array with a minimum and maximum size where each item must match the following example @param minSize minimum size of the array @param maxSize maximum size of the array
[ "Element", "that", "is", "an", "array", "with", "a", "minimum", "and", "maximum", "size", "where", "each", "item", "must", "match", "the", "following", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslJsonArray.java#L372-L378
117,316
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java
LambdaDslObject.eachLike
public LambdaDslObject eachLike(String name, Consumer<LambdaDslObject> nestedObject) { final PactDslJsonBody arrayLike = object.eachLike(name); final LambdaDslObject dslObject = new LambdaDslObject(arrayLike); nestedObject.accept(dslObject); arrayLike.closeArray(); return this; ...
java
public LambdaDslObject eachLike(String name, Consumer<LambdaDslObject> nestedObject) { final PactDslJsonBody arrayLike = object.eachLike(name); final LambdaDslObject dslObject = new LambdaDslObject(arrayLike); nestedObject.accept(dslObject); arrayLike.closeArray(); return this; ...
[ "public", "LambdaDslObject", "eachLike", "(", "String", "name", ",", "Consumer", "<", "LambdaDslObject", ">", "nestedObject", ")", "{", "final", "PactDslJsonBody", "arrayLike", "=", "object", ".", "eachLike", "(", "name", ")", ";", "final", "LambdaDslObject", "d...
Attribute that is an array where each item must match the following example @param name field name
[ "Attribute", "that", "is", "an", "array", "where", "each", "item", "must", "match", "the", "following", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java#L387-L393
117,317
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java
LambdaDslObject.eachLike
public LambdaDslObject eachLike(String name, PactDslJsonRootValue value, int numberExamples) { object.eachLike(name, value, numberExamples); return this; }
java
public LambdaDslObject eachLike(String name, PactDslJsonRootValue value, int numberExamples) { object.eachLike(name, value, numberExamples); return this; }
[ "public", "LambdaDslObject", "eachLike", "(", "String", "name", ",", "PactDslJsonRootValue", "value", ",", "int", "numberExamples", ")", "{", "object", ".", "eachLike", "(", "name", ",", "value", ",", "numberExamples", ")", ";", "return", "this", ";", "}" ]
Attribute that is an array where each item is a primitive that must match the provided value @param name field name @param value Value that each item in the array must match @param numberExamples Number of examples to generate
[ "Attribute", "that", "is", "an", "array", "where", "each", "item", "is", "a", "primitive", "that", "must", "match", "the", "provided", "value" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java#L427-L430
117,318
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java
LambdaDslObject.minArrayLike
public LambdaDslObject minArrayLike(String name, Integer size, Consumer<LambdaDslObject> nestedObject) { final PactDslJsonBody minArrayLike = object.minArrayLike(name, size); final LambdaDslObject dslObject = new LambdaDslObject(minArrayLike); nestedObject.accept(dslObject); minArrayLike...
java
public LambdaDslObject minArrayLike(String name, Integer size, Consumer<LambdaDslObject> nestedObject) { final PactDslJsonBody minArrayLike = object.minArrayLike(name, size); final LambdaDslObject dslObject = new LambdaDslObject(minArrayLike); nestedObject.accept(dslObject); minArrayLike...
[ "public", "LambdaDslObject", "minArrayLike", "(", "String", "name", ",", "Integer", "size", ",", "Consumer", "<", "LambdaDslObject", ">", "nestedObject", ")", "{", "final", "PactDslJsonBody", "minArrayLike", "=", "object", ".", "minArrayLike", "(", "name", ",", ...
Attribute that is an array with a minimum size where each item must match the following example @param name field name @param size minimum size of the array
[ "Attribute", "that", "is", "an", "array", "with", "a", "minimum", "size", "where", "each", "item", "must", "match", "the", "following", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java#L438-L444
117,319
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java
LambdaDslObject.minArrayLike
public LambdaDslObject minArrayLike(String name, Integer size, PactDslJsonRootValue value, int numberExamples) { object.minArrayLike(name, size, value, numberExamples); return this; }
java
public LambdaDslObject minArrayLike(String name, Integer size, PactDslJsonRootValue value, int numberExamples) { object.minArrayLike(name, size, value, numberExamples); return this; }
[ "public", "LambdaDslObject", "minArrayLike", "(", "String", "name", ",", "Integer", "size", ",", "PactDslJsonRootValue", "value", ",", "int", "numberExamples", ")", "{", "object", ".", "minArrayLike", "(", "name", ",", "size", ",", "value", ",", "numberExamples"...
Attribute that is an array of values with a minimum size that are not objects where each item must match the following example @param name field name @param size minimum size of the array @param value Value to use to match each item @param numberExamples number of examples to generate
[ "Attribute", "that", "is", "an", "array", "of", "values", "with", "a", "minimum", "size", "that", "are", "not", "objects", "where", "each", "item", "must", "match", "the", "following", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java#L470-L473
117,320
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java
LambdaDslObject.maxArrayLike
public LambdaDslObject maxArrayLike(String name, Integer size, Consumer<LambdaDslObject> nestedObject) { final PactDslJsonBody maxArrayLike = object.maxArrayLike(name, size); final LambdaDslObject dslObject = new LambdaDslObject(maxArrayLike); nestedObject.accept(dslObject); maxArrayLike...
java
public LambdaDslObject maxArrayLike(String name, Integer size, Consumer<LambdaDslObject> nestedObject) { final PactDslJsonBody maxArrayLike = object.maxArrayLike(name, size); final LambdaDslObject dslObject = new LambdaDslObject(maxArrayLike); nestedObject.accept(dslObject); maxArrayLike...
[ "public", "LambdaDslObject", "maxArrayLike", "(", "String", "name", ",", "Integer", "size", ",", "Consumer", "<", "LambdaDslObject", ">", "nestedObject", ")", "{", "final", "PactDslJsonBody", "maxArrayLike", "=", "object", ".", "maxArrayLike", "(", "name", ",", ...
Attribute that is an array with a maximum size where each item must match the following example @param name field name @param size maximum size of the array
[ "Attribute", "that", "is", "an", "array", "with", "a", "maximum", "size", "where", "each", "item", "must", "match", "the", "following", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java#L481-L487
117,321
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java
LambdaDslObject.minMaxArrayLike
public LambdaDslObject minMaxArrayLike(String name, Integer minSize, Integer maxSize, int numberExamples, Consumer<LambdaDslObject> nestedObject) { final PactDslJsonBody maxArrayLike = object.minMaxArrayLike(name, minSize, maxSize, numberExamples); final LambdaDslObject dsl...
java
public LambdaDslObject minMaxArrayLike(String name, Integer minSize, Integer maxSize, int numberExamples, Consumer<LambdaDslObject> nestedObject) { final PactDslJsonBody maxArrayLike = object.minMaxArrayLike(name, minSize, maxSize, numberExamples); final LambdaDslObject dsl...
[ "public", "LambdaDslObject", "minMaxArrayLike", "(", "String", "name", ",", "Integer", "minSize", ",", "Integer", "maxSize", ",", "int", "numberExamples", ",", "Consumer", "<", "LambdaDslObject", ">", "nestedObject", ")", "{", "final", "PactDslJsonBody", "maxArrayLi...
Attribute that is an array with a minimum and maximum size where each item must match the following example @param name field name @param minSize minimum size of the array @param maxSize maximum size of the array @param numberExamples number of examples to generate
[ "Attribute", "that", "is", "an", "array", "with", "a", "minimum", "and", "maximum", "size", "where", "each", "item", "must", "match", "the", "following", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java#L541-L548
117,322
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java
LambdaDslObject.minMaxArrayLike
public LambdaDslObject minMaxArrayLike(String name, Integer minSize, Integer maxSize, PactDslJsonRootValue value, int numberExamples) { object.minMaxArrayLike(name, minSize, maxSize, value, numberExamples); return this; }
java
public LambdaDslObject minMaxArrayLike(String name, Integer minSize, Integer maxSize, PactDslJsonRootValue value, int numberExamples) { object.minMaxArrayLike(name, minSize, maxSize, value, numberExamples); return this; }
[ "public", "LambdaDslObject", "minMaxArrayLike", "(", "String", "name", ",", "Integer", "minSize", ",", "Integer", "maxSize", ",", "PactDslJsonRootValue", "value", ",", "int", "numberExamples", ")", "{", "object", ".", "minMaxArrayLike", "(", "name", ",", "minSize"...
Attribute that is an array of values with a minimum and maximum size that are not objects where each item must match the following example @param name field name @param minSize minimum size of the array @param maxSize maximum size of the array @param value Value to use to match each item @param numberExamples number of...
[ "Attribute", "that", "is", "an", "array", "of", "values", "with", "a", "minimum", "and", "maximum", "size", "that", "are", "not", "objects", "where", "each", "item", "must", "match", "the", "following", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java#L559-L563
117,323
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslWithState.java
PactDslWithState.given
public PactDslWithState given(String stateDesc, Map<String, Object> params) { state.add(new ProviderState(stateDesc, params)); return this; }
java
public PactDslWithState given(String stateDesc, Map<String, Object> params) { state.add(new ProviderState(stateDesc, params)); return this; }
[ "public", "PactDslWithState", "given", "(", "String", "stateDesc", ",", "Map", "<", "String", ",", "Object", ">", "params", ")", "{", "state", ".", "add", "(", "new", "ProviderState", "(", "stateDesc", ",", "params", ")", ")", ";", "return", "this", ";",...
Adds another provider state to this interaction @param stateDesc Description of the state @param params State data parameters
[ "Adds", "another", "provider", "state", "to", "this", "interaction" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslWithState.java#L59-L62
117,324
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslWithProvider.java
PactDslWithProvider.uponReceiving
public PactDslRequestWithoutPath uponReceiving(String description) { return new PactDslWithState(consumerPactBuilder, consumerPactBuilder.getConsumerName(), providerName, defaultRequestValues, defaultResponseValues) .uponReceiving(description); }
java
public PactDslRequestWithoutPath uponReceiving(String description) { return new PactDslWithState(consumerPactBuilder, consumerPactBuilder.getConsumerName(), providerName, defaultRequestValues, defaultResponseValues) .uponReceiving(description); }
[ "public", "PactDslRequestWithoutPath", "uponReceiving", "(", "String", "description", ")", "{", "return", "new", "PactDslWithState", "(", "consumerPactBuilder", ",", "consumerPactBuilder", ".", "getConsumerName", "(", ")", ",", "providerName", ",", "defaultRequestValues",...
Description of the request that is expected to be received @param description request description
[ "Description", "of", "the", "request", "that", "is", "expected", "to", "be", "received" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslWithProvider.java#L71-L75
117,325
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.closeArray
public DslPart closeArray() { if (parent != null) { parent.putArray(this); } else { getMatchers().applyMatcherRootPrefix("$"); getGenerators().applyRootPrefix("$"); } closed = true; return parent; }
java
public DslPart closeArray() { if (parent != null) { parent.putArray(this); } else { getMatchers().applyMatcherRootPrefix("$"); getGenerators().applyRootPrefix("$"); } closed = true; return parent; }
[ "public", "DslPart", "closeArray", "(", ")", "{", "if", "(", "parent", "!=", "null", ")", "{", "parent", ".", "putArray", "(", "this", ")", ";", "}", "else", "{", "getMatchers", "(", ")", ".", "applyMatcherRootPrefix", "(", "\"$\"", ")", ";", "getGener...
Closes the current array
[ "Closes", "the", "current", "array" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L92-L101
117,326
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.maxArrayLike
@Override public PactDslJsonBody maxArrayLike(Integer size, int numberExamples) { if (numberExamples > size) { throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d", numberExamples, size)); } matchers.addRule(rootPath + append...
java
@Override public PactDslJsonBody maxArrayLike(Integer size, int numberExamples) { if (numberExamples > size) { throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d", numberExamples, size)); } matchers.addRule(rootPath + append...
[ "@", "Override", "public", "PactDslJsonBody", "maxArrayLike", "(", "Integer", "size", ",", "int", "numberExamples", ")", "{", "if", "(", "numberExamples", ">", "size", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"...
Element that is an array with a maximum size where each item must match the following example @param size maximum size of the array @param numberExamples number of examples to generate
[ "Element", "that", "is", "an", "array", "with", "a", "maximum", "size", "where", "each", "item", "must", "match", "the", "following", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L209-L219
117,327
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.stringValue
public PactDslJsonArray stringValue(String value) { if (value == null) { body.put(JSONObject.NULL); } else { body.put(value); } return this; }
java
public PactDslJsonArray stringValue(String value) { if (value == null) { body.put(JSONObject.NULL); } else { body.put(value); } return this; }
[ "public", "PactDslJsonArray", "stringValue", "(", "String", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "body", ".", "put", "(", "JSONObject", ".", "NULL", ")", ";", "}", "else", "{", "body", ".", "put", "(", "value", ")", ";", "...
Element that must be the specified value @param value string value
[ "Element", "that", "must", "be", "the", "specified", "value" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L252-L259
117,328
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.integerType
public PactDslJsonArray integerType(Long number) { body.put(number); matchers.addRule(rootPath + appendArrayIndex(0), new NumberTypeMatcher(NumberTypeMatcher.NumberType.INTEGER)); return this; }
java
public PactDslJsonArray integerType(Long number) { body.put(number); matchers.addRule(rootPath + appendArrayIndex(0), new NumberTypeMatcher(NumberTypeMatcher.NumberType.INTEGER)); return this; }
[ "public", "PactDslJsonArray", "integerType", "(", "Long", "number", ")", "{", "body", ".", "put", "(", "number", ")", ";", "matchers", ".", "addRule", "(", "rootPath", "+", "appendArrayIndex", "(", "0", ")", ",", "new", "NumberTypeMatcher", "(", "NumberTypeM...
Element that must be an integer @param number example integer value to use for generated bodies
[ "Element", "that", "must", "be", "an", "integer" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L341-L345
117,329
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.decimalType
public PactDslJsonArray decimalType() { generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(1), new RandomDecimalGenerator(10)); return decimalType(new BigDecimal("100")); }
java
public PactDslJsonArray decimalType() { generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(1), new RandomDecimalGenerator(10)); return decimalType(new BigDecimal("100")); }
[ "public", "PactDslJsonArray", "decimalType", "(", ")", "{", "generators", ".", "addGenerator", "(", "Category", ".", "BODY", ",", "rootPath", "+", "appendArrayIndex", "(", "1", ")", ",", "new", "RandomDecimalGenerator", "(", "10", ")", ")", ";", "return", "d...
Element that must be a decimal value
[ "Element", "that", "must", "be", "a", "decimal", "value" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L369-L372
117,330
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.decimalType
public PactDslJsonArray decimalType(BigDecimal number) { body.put(number); matchers.addRule(rootPath + appendArrayIndex(0), new NumberTypeMatcher(NumberTypeMatcher.NumberType.DECIMAL)); return this; }
java
public PactDslJsonArray decimalType(BigDecimal number) { body.put(number); matchers.addRule(rootPath + appendArrayIndex(0), new NumberTypeMatcher(NumberTypeMatcher.NumberType.DECIMAL)); return this; }
[ "public", "PactDslJsonArray", "decimalType", "(", "BigDecimal", "number", ")", "{", "body", ".", "put", "(", "number", ")", ";", "matchers", ".", "addRule", "(", "rootPath", "+", "appendArrayIndex", "(", "0", ")", ",", "new", "NumberTypeMatcher", "(", "Numbe...
Element that must be a decimalType value @param number example decimalType value
[ "Element", "that", "must", "be", "a", "decimalType", "value" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L378-L382
117,331
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.timestamp
public PactDslJsonArray timestamp() { String pattern = DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(); body.put(DateFormatUtils.ISO_DATETIME_FORMAT.format(new Date(DATE_2000))); generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(0), new DateTimeGenerator(pattern)); matchers.add...
java
public PactDslJsonArray timestamp() { String pattern = DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(); body.put(DateFormatUtils.ISO_DATETIME_FORMAT.format(new Date(DATE_2000))); generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(0), new DateTimeGenerator(pattern)); matchers.add...
[ "public", "PactDslJsonArray", "timestamp", "(", ")", "{", "String", "pattern", "=", "DateFormatUtils", ".", "ISO_DATETIME_FORMAT", ".", "getPattern", "(", ")", ";", "body", ".", "put", "(", "DateFormatUtils", ".", "ISO_DATETIME_FORMAT", ".", "format", "(", "new"...
Element that must be an ISO formatted timestamp
[ "Element", "that", "must", "be", "an", "ISO", "formatted", "timestamp" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L444-L450
117,332
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.date
public PactDslJsonArray date() { String pattern = DateFormatUtils.ISO_DATE_FORMAT.getPattern(); body.put(DateFormatUtils.ISO_DATE_FORMAT.format(new Date(DATE_2000))); generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(0), new DateGenerator(pattern)); matchers.addRule(rootPath + a...
java
public PactDslJsonArray date() { String pattern = DateFormatUtils.ISO_DATE_FORMAT.getPattern(); body.put(DateFormatUtils.ISO_DATE_FORMAT.format(new Date(DATE_2000))); generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(0), new DateGenerator(pattern)); matchers.addRule(rootPath + a...
[ "public", "PactDslJsonArray", "date", "(", ")", "{", "String", "pattern", "=", "DateFormatUtils", ".", "ISO_DATE_FORMAT", ".", "getPattern", "(", ")", ";", "body", ".", "put", "(", "DateFormatUtils", ".", "ISO_DATE_FORMAT", ".", "format", "(", "new", "Date", ...
Element that must be formatted as an ISO date
[ "Element", "that", "must", "be", "formatted", "as", "an", "ISO", "date" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L491-L497
117,333
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.time
public PactDslJsonArray time() { String pattern = DateFormatUtils.ISO_TIME_FORMAT.getPattern(); body.put(DateFormatUtils.ISO_TIME_FORMAT.format(new Date(DATE_2000))); generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(0), new TimeGenerator(pattern)); matchers.addRule(rootPath + a...
java
public PactDslJsonArray time() { String pattern = DateFormatUtils.ISO_TIME_FORMAT.getPattern(); body.put(DateFormatUtils.ISO_TIME_FORMAT.format(new Date(DATE_2000))); generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(0), new TimeGenerator(pattern)); matchers.addRule(rootPath + a...
[ "public", "PactDslJsonArray", "time", "(", ")", "{", "String", "pattern", "=", "DateFormatUtils", ".", "ISO_TIME_FORMAT", ".", "getPattern", "(", ")", ";", "body", ".", "put", "(", "DateFormatUtils", ".", "ISO_TIME_FORMAT", ".", "format", "(", "new", "Date", ...
Element that must be an ISO formatted time
[ "Element", "that", "must", "be", "an", "ISO", "formatted", "time" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L526-L532
117,334
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.template
public PactDslJsonArray template(DslPart template, int occurrences) { for(int i = 0; i < occurrences; i++) { template(template); } return this; }
java
public PactDslJsonArray template(DslPart template, int occurrences) { for(int i = 0; i < occurrences; i++) { template(template); } return this; }
[ "public", "PactDslJsonArray", "template", "(", "DslPart", "template", ",", "int", "occurrences", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "occurrences", ";", "i", "++", ")", "{", "template", "(", "template", ")", ";", "}", "return", ...
Adds a number of template objects to the array @param template template object @param occurrences number to add
[ "Adds", "a", "number", "of", "template", "objects", "to", "the", "array" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L708-L713
117,335
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.arrayEachLike
public static PactDslJsonBody arrayEachLike(Integer numberExamples) { PactDslJsonArray parent = new PactDslJsonArray("", "", null, true); parent.setNumberExamples(numberExamples); parent.matchers.addRule("", parent.matchMin(0)); return new PactDslJsonBody(".", "", parent); }
java
public static PactDslJsonBody arrayEachLike(Integer numberExamples) { PactDslJsonArray parent = new PactDslJsonArray("", "", null, true); parent.setNumberExamples(numberExamples); parent.matchers.addRule("", parent.matchMin(0)); return new PactDslJsonBody(".", "", parent); }
[ "public", "static", "PactDslJsonBody", "arrayEachLike", "(", "Integer", "numberExamples", ")", "{", "PactDslJsonArray", "parent", "=", "new", "PactDslJsonArray", "(", "\"\"", ",", "\"\"", ",", "null", ",", "true", ")", ";", "parent", ".", "setNumberExamples", "(...
Array where each item must match the following example @param numberExamples Number of examples to generate
[ "Array", "where", "each", "item", "must", "match", "the", "following", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L739-L744
117,336
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.arrayEachLike
public static PactDslJsonArray arrayEachLike(Integer numberExamples, PactDslJsonRootValue value) { PactDslJsonArray parent = new PactDslJsonArray("", "", null, true); parent.setNumberExamples(numberExamples); parent.matchers.addRule("", parent.matchMin(0)); parent.putObject(value); return parent; ...
java
public static PactDslJsonArray arrayEachLike(Integer numberExamples, PactDslJsonRootValue value) { PactDslJsonArray parent = new PactDslJsonArray("", "", null, true); parent.setNumberExamples(numberExamples); parent.matchers.addRule("", parent.matchMin(0)); parent.putObject(value); return parent; ...
[ "public", "static", "PactDslJsonArray", "arrayEachLike", "(", "Integer", "numberExamples", ",", "PactDslJsonRootValue", "value", ")", "{", "PactDslJsonArray", "parent", "=", "new", "PactDslJsonArray", "(", "\"\"", ",", "\"\"", ",", "null", ",", "true", ")", ";", ...
Root level array where each item must match the provided matcher @param numberExamples Number of examples to generate
[ "Root", "level", "array", "where", "each", "item", "must", "match", "the", "provided", "matcher" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L757-L763
117,337
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.arrayMinLike
public static PactDslJsonBody arrayMinLike(int minSize, int numberExamples) { if (numberExamples < minSize) { throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d", numberExamples, minSize)); } PactDslJsonArray parent = new PactDslJsonArray...
java
public static PactDslJsonBody arrayMinLike(int minSize, int numberExamples) { if (numberExamples < minSize) { throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d", numberExamples, minSize)); } PactDslJsonArray parent = new PactDslJsonArray...
[ "public", "static", "PactDslJsonBody", "arrayMinLike", "(", "int", "minSize", ",", "int", "numberExamples", ")", "{", "if", "(", "numberExamples", "<", "minSize", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"Number ...
Array with a minimum size where each item must match the following example @param minSize minimum size @param numberExamples Number of examples to generate
[ "Array", "with", "a", "minimum", "size", "where", "each", "item", "must", "match", "the", "following", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L778-L787
117,338
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.arrayMinLike
public static PactDslJsonArray arrayMinLike(int minSize, int numberExamples, PactDslJsonRootValue value) { if (numberExamples < minSize) { throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d", numberExamples, minSize)); } PactDslJsonArray ...
java
public static PactDslJsonArray arrayMinLike(int minSize, int numberExamples, PactDslJsonRootValue value) { if (numberExamples < minSize) { throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d", numberExamples, minSize)); } PactDslJsonArray ...
[ "public", "static", "PactDslJsonArray", "arrayMinLike", "(", "int", "minSize", ",", "int", "numberExamples", ",", "PactDslJsonRootValue", "value", ")", "{", "if", "(", "numberExamples", "<", "minSize", ")", "{", "throw", "new", "IllegalArgumentException", "(", "St...
Root level array with minimum size where each item must match the provided matcher @param minSize minimum size @param numberExamples Number of examples to generate
[ "Root", "level", "array", "with", "minimum", "size", "where", "each", "item", "must", "match", "the", "provided", "matcher" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L802-L812
117,339
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.arrayMaxLike
public static PactDslJsonBody arrayMaxLike(int maxSize, int numberExamples) { if (numberExamples > maxSize) { throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d", numberExamples, maxSize)); } PactDslJsonArray parent = new PactDslJsonArray...
java
public static PactDslJsonBody arrayMaxLike(int maxSize, int numberExamples) { if (numberExamples > maxSize) { throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d", numberExamples, maxSize)); } PactDslJsonArray parent = new PactDslJsonArray...
[ "public", "static", "PactDslJsonBody", "arrayMaxLike", "(", "int", "maxSize", ",", "int", "numberExamples", ")", "{", "if", "(", "numberExamples", ">", "maxSize", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"Number ...
Array with a maximum size where each item must match the following example @param maxSize maximum size @param numberExamples Number of examples to generate
[ "Array", "with", "a", "maximum", "size", "where", "each", "item", "must", "match", "the", "following", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L827-L836
117,340
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.arrayMaxLike
public static PactDslJsonArray arrayMaxLike(int maxSize, int numberExamples, PactDslJsonRootValue value) { if (numberExamples > maxSize) { throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d", numberExamples, maxSize)); } PactDslJsonArray ...
java
public static PactDslJsonArray arrayMaxLike(int maxSize, int numberExamples, PactDslJsonRootValue value) { if (numberExamples > maxSize) { throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d", numberExamples, maxSize)); } PactDslJsonArray ...
[ "public", "static", "PactDslJsonArray", "arrayMaxLike", "(", "int", "maxSize", ",", "int", "numberExamples", ",", "PactDslJsonRootValue", "value", ")", "{", "if", "(", "numberExamples", ">", "maxSize", ")", "{", "throw", "new", "IllegalArgumentException", "(", "St...
Root level array with maximum size where each item must match the provided matcher @param maxSize maximum size @param numberExamples Number of examples to generate
[ "Root", "level", "array", "with", "maximum", "size", "where", "each", "item", "must", "match", "the", "provided", "matcher" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L851-L861
117,341
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.arrayMinMaxLike
public static PactDslJsonBody arrayMinMaxLike(int minSize, int maxSize, int numberExamples) { if (numberExamples < minSize) { throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d", numberExamples, minSize)); } else if (numberExamples > maxSize)...
java
public static PactDslJsonBody arrayMinMaxLike(int minSize, int maxSize, int numberExamples) { if (numberExamples < minSize) { throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d", numberExamples, minSize)); } else if (numberExamples > maxSize)...
[ "public", "static", "PactDslJsonBody", "arrayMinMaxLike", "(", "int", "minSize", ",", "int", "maxSize", ",", "int", "numberExamples", ")", "{", "if", "(", "numberExamples", "<", "minSize", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".",...
Array with a minimum and maximum size where each item must match the following example @param minSize minimum size @param maxSize maximum size @param numberExamples Number of examples to generate
[ "Array", "with", "a", "minimum", "and", "maximum", "size", "where", "each", "item", "must", "match", "the", "following", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L878-L890
117,342
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.eachLike
public PactDslJsonArray eachLike(PactDslJsonRootValue value, int numberExamples) { if (numberExamples == 0) { throw new IllegalArgumentException("Testing Zero examples is unsafe. Please make sure to provide at least one " + "example in the Pact provider implementation. See https://github.com/DiUS/pact...
java
public PactDslJsonArray eachLike(PactDslJsonRootValue value, int numberExamples) { if (numberExamples == 0) { throw new IllegalArgumentException("Testing Zero examples is unsafe. Please make sure to provide at least one " + "example in the Pact provider implementation. See https://github.com/DiUS/pact...
[ "public", "PactDslJsonArray", "eachLike", "(", "PactDslJsonRootValue", "value", ",", "int", "numberExamples", ")", "{", "if", "(", "numberExamples", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Testing Zero examples is unsafe. Please make sure ...
Array of values that are not objects where each item must match the provided example @param value Value to use to match each item @param numberExamples number of examples to generate
[ "Array", "of", "values", "that", "are", "not", "objects", "where", "each", "item", "must", "match", "the", "provided", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L1034-L1045
117,343
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.minArrayLike
public PactDslJsonArray minArrayLike(Integer size, PactDslJsonRootValue value) { return minArrayLike(size, value, size); }
java
public PactDslJsonArray minArrayLike(Integer size, PactDslJsonRootValue value) { return minArrayLike(size, value, size); }
[ "public", "PactDslJsonArray", "minArrayLike", "(", "Integer", "size", ",", "PactDslJsonRootValue", "value", ")", "{", "return", "minArrayLike", "(", "size", ",", "value", ",", "size", ")", ";", "}" ]
Array of values with a minimum size that are not objects where each item must match the provided example @param size minimum size of the array @param value Value to use to match each item
[ "Array", "of", "values", "with", "a", "minimum", "size", "that", "are", "not", "objects", "where", "each", "item", "must", "match", "the", "provided", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L1052-L1054
117,344
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.maxArrayLike
public PactDslJsonArray maxArrayLike(Integer size, PactDslJsonRootValue value, int numberExamples) { if (numberExamples > size) { throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d", numberExamples, size)); } matchers.addRule(rootPath + a...
java
public PactDslJsonArray maxArrayLike(Integer size, PactDslJsonRootValue value, int numberExamples) { if (numberExamples > size) { throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d", numberExamples, size)); } matchers.addRule(rootPath + a...
[ "public", "PactDslJsonArray", "maxArrayLike", "(", "Integer", "size", ",", "PactDslJsonRootValue", "value", ",", "int", "numberExamples", ")", "{", "if", "(", "numberExamples", ">", "size", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", ...
Array of values with a maximum size that are not objects where each item must match the provided example @param size maximum size of the array @param value Value to use to match each item @param numberExamples number of examples to generate
[ "Array", "of", "values", "with", "a", "maximum", "size", "that", "are", "not", "objects", "where", "each", "item", "must", "match", "the", "provided", "example" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L1089-L1099
117,345
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.includesStr
public PactDslJsonArray includesStr(String value) { body.put(value); matchers.addRule(rootPath + appendArrayIndex(0), includesMatcher(value)); return this; }
java
public PactDslJsonArray includesStr(String value) { body.put(value); matchers.addRule(rootPath + appendArrayIndex(0), includesMatcher(value)); return this; }
[ "public", "PactDslJsonArray", "includesStr", "(", "String", "value", ")", "{", "body", ".", "put", "(", "value", ")", ";", "matchers", ".", "addRule", "(", "rootPath", "+", "appendArrayIndex", "(", "0", ")", ",", "includesMatcher", "(", "value", ")", ")", ...
List item that must include the provided string @param value Value that must be included
[ "List", "item", "that", "must", "include", "the", "provided", "string" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L1105-L1109
117,346
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.equalsTo
public PactDslJsonArray equalsTo(Object value) { body.put(value); matchers.addRule(rootPath + appendArrayIndex(0), EqualsMatcher.INSTANCE); return this; }
java
public PactDslJsonArray equalsTo(Object value) { body.put(value); matchers.addRule(rootPath + appendArrayIndex(0), EqualsMatcher.INSTANCE); return this; }
[ "public", "PactDslJsonArray", "equalsTo", "(", "Object", "value", ")", "{", "body", ".", "put", "(", "value", ")", ";", "matchers", ".", "addRule", "(", "rootPath", "+", "appendArrayIndex", "(", "0", ")", ",", "EqualsMatcher", ".", "INSTANCE", ")", ";", ...
Attribute that must be equal to the provided value. @param value Value that will be used for comparisons
[ "Attribute", "that", "must", "be", "equal", "to", "the", "provided", "value", "." ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L1115-L1119
117,347
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.valueFromProviderState
public PactDslJsonArray valueFromProviderState(String expression, Object example) { generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(0), new ProviderStateGenerator(expression)); body.put(example); return this; }
java
public PactDslJsonArray valueFromProviderState(String expression, Object example) { generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(0), new ProviderStateGenerator(expression)); body.put(example); return this; }
[ "public", "PactDslJsonArray", "valueFromProviderState", "(", "String", "expression", ",", "Object", "example", ")", "{", "generators", ".", "addGenerator", "(", "Category", ".", "BODY", ",", "rootPath", "+", "appendArrayIndex", "(", "0", ")", ",", "new", "Provid...
Adds an element that will have it's value injected from the provider state @param expression Expression to be evaluated from the provider state @param example Example value to be used in the consumer test
[ "Adds", "an", "element", "that", "will", "have", "it", "s", "value", "injected", "from", "the", "provider", "state" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L1234-L1238
117,348
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithoutPath.java
PactDslRequestWithoutPath.withFileUpload
public PactDslRequestWithoutPath withFileUpload(String partName, String fileName, String fileContentType, byte[] data) throws IOException { setupFileUpload(partName, fileName, fileContentType, data); return this; }
java
public PactDslRequestWithoutPath withFileUpload(String partName, String fileName, String fileContentType, byte[] data) throws IOException { setupFileUpload(partName, fileName, fileContentType, data); return this; }
[ "public", "PactDslRequestWithoutPath", "withFileUpload", "(", "String", "partName", ",", "String", "fileName", ",", "String", "fileContentType", ",", "byte", "[", "]", "data", ")", "throws", "IOException", "{", "setupFileUpload", "(", "partName", ",", "fileName", ...
Sets up a file upload request. This will add the correct content type header to the request @param partName This is the name of the part in the multipart body. @param fileName This is the name of the file that was uploaded @param fileContentType This is the content type of the uploaded file @param data This is the actu...
[ "Sets", "up", "a", "file", "upload", "request", ".", "This", "will", "add", "the", "correct", "content", "type", "header", "to", "the", "request" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithoutPath.java#L284-L288
117,349
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithoutPath.java
PactDslRequestWithoutPath.headerFromProviderState
public PactDslRequestWithoutPath headerFromProviderState(String name, String expression, String example) { requestGenerators.addGenerator(Category.HEADER, name, new ProviderStateGenerator(expression)); requestHeaders.put(name, Collections.singletonList(example)); return this; }
java
public PactDslRequestWithoutPath headerFromProviderState(String name, String expression, String example) { requestGenerators.addGenerator(Category.HEADER, name, new ProviderStateGenerator(expression)); requestHeaders.put(name, Collections.singletonList(example)); return this; }
[ "public", "PactDslRequestWithoutPath", "headerFromProviderState", "(", "String", "name", ",", "String", "expression", ",", "String", "example", ")", "{", "requestGenerators", ".", "addGenerator", "(", "Category", ".", "HEADER", ",", "name", ",", "new", "ProviderStat...
Adds a header that will have it's value injected from the provider state @param name Header Name @param expression Expression to be evaluated from the provider state @param example Example value to use in the consumer test
[ "Adds", "a", "header", "that", "will", "have", "it", "s", "value", "injected", "from", "the", "provider", "state" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithoutPath.java#L296-L300
117,350
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithoutPath.java
PactDslRequestWithoutPath.queryParameterFromProviderState
public PactDslRequestWithoutPath queryParameterFromProviderState(String name, String expression, String example) { requestGenerators.addGenerator(Category.QUERY, name, new ProviderStateGenerator(expression)); query.put(name, Collections.singletonList(example)); return this; }
java
public PactDslRequestWithoutPath queryParameterFromProviderState(String name, String expression, String example) { requestGenerators.addGenerator(Category.QUERY, name, new ProviderStateGenerator(expression)); query.put(name, Collections.singletonList(example)); return this; }
[ "public", "PactDslRequestWithoutPath", "queryParameterFromProviderState", "(", "String", "name", ",", "String", "expression", ",", "String", "example", ")", "{", "requestGenerators", ".", "addGenerator", "(", "Category", ".", "QUERY", ",", "name", ",", "new", "Provi...
Adds a query parameter that will have it's value injected from the provider state @param name Name @param expression Expression to be evaluated from the provider state @param example Example value to use in the consumer test
[ "Adds", "a", "query", "parameter", "that", "will", "have", "it", "s", "value", "injected", "from", "the", "provider", "state" ]
2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithoutPath.java#L308-L312
117,351
spotify/styx
styx-service-common/src/main/java/com/spotify/styx/util/ConfigUtil.java
ConfigUtil.get
public static <T> Optional<T> get(Config config, Function<String, T> getter, String path) { if (!config.hasPath(path)) { return Optional.empty(); } return Optional.of(getter.apply(path)); }
java
public static <T> Optional<T> get(Config config, Function<String, T> getter, String path) { if (!config.hasPath(path)) { return Optional.empty(); } return Optional.of(getter.apply(path)); }
[ "public", "static", "<", "T", ">", "Optional", "<", "T", ">", "get", "(", "Config", "config", ",", "Function", "<", "String", ",", "T", ">", "getter", ",", "String", "path", ")", "{", "if", "(", "!", "config", ".", "hasPath", "(", "path", ")", ")...
Optionally get a configuration value.
[ "Optionally", "get", "a", "configuration", "value", "." ]
0d63999beeb93a17447e3bbccaa62175b74cf6e4
https://github.com/spotify/styx/blob/0d63999beeb93a17447e3bbccaa62175b74cf6e4/styx-service-common/src/main/java/com/spotify/styx/util/ConfigUtil.java#L37-L42
117,352
spotify/styx
styx-service-common/src/main/java/com/spotify/styx/api/Authenticator.java
Authenticator.authenticate
GoogleIdToken authenticate(String token) { final GoogleIdToken googleIdToken; try { googleIdToken = verifyIdToken(token); } catch (IOException e) { logger.warn("Failed to verify token"); return null; } if (googleIdToken == null) { logger.debug("Invalid id token: verifyIdToke...
java
GoogleIdToken authenticate(String token) { final GoogleIdToken googleIdToken; try { googleIdToken = verifyIdToken(token); } catch (IOException e) { logger.warn("Failed to verify token"); return null; } if (googleIdToken == null) { logger.debug("Invalid id token: verifyIdToke...
[ "GoogleIdToken", "authenticate", "(", "String", "token", ")", "{", "final", "GoogleIdToken", "googleIdToken", ";", "try", "{", "googleIdToken", "=", "verifyIdToken", "(", "token", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "war...
Authenticate and authorize a Google ID token string from an incoming Styx API request. @param token The Google ID token string. @return A {@link GoogleIdToken} instance if the token was valid and the user is authorized.
[ "Authenticate", "and", "authorize", "a", "Google", "ID", "token", "string", "from", "an", "incoming", "Styx", "API", "request", "." ]
0d63999beeb93a17447e3bbccaa62175b74cf6e4
https://github.com/spotify/styx/blob/0d63999beeb93a17447e3bbccaa62175b74cf6e4/styx-service-common/src/main/java/com/spotify/styx/api/Authenticator.java#L121-L187
117,353
spotify/styx
styx-service-common/src/main/java/com/spotify/styx/util/ShardedCounter.java
ShardedCounter.getCounterSnapshot
public CounterSnapshot getCounterSnapshot(String counterId) throws IOException { final CounterSnapshot snapshot = inMemSnapshot.getIfPresent(counterId); if (snapshot != null) { stats.recordCounterCacheHit(); return snapshot; } stats.recordCounterCacheMiss(); return refreshCounterSnapshot...
java
public CounterSnapshot getCounterSnapshot(String counterId) throws IOException { final CounterSnapshot snapshot = inMemSnapshot.getIfPresent(counterId); if (snapshot != null) { stats.recordCounterCacheHit(); return snapshot; } stats.recordCounterCacheMiss(); return refreshCounterSnapshot...
[ "public", "CounterSnapshot", "getCounterSnapshot", "(", "String", "counterId", ")", "throws", "IOException", "{", "final", "CounterSnapshot", "snapshot", "=", "inMemSnapshot", ".", "getIfPresent", "(", "counterId", ")", ";", "if", "(", "snapshot", "!=", "null", ")...
Returns a recent snapshot, possibly read from inMemSnapshot.
[ "Returns", "a", "recent", "snapshot", "possibly", "read", "from", "inMemSnapshot", "." ]
0d63999beeb93a17447e3bbccaa62175b74cf6e4
https://github.com/spotify/styx/blob/0d63999beeb93a17447e3bbccaa62175b74cf6e4/styx-service-common/src/main/java/com/spotify/styx/util/ShardedCounter.java#L185-L193
117,354
spotify/styx
styx-service-common/src/main/java/com/spotify/styx/util/ShardedCounter.java
ShardedCounter.refreshCounterSnapshot
private CounterSnapshot refreshCounterSnapshot(String counterId) throws IOException { final CounterSnapshot newSnapshot = counterSnapshotFactory.create(counterId); inMemSnapshot.put(counterId, newSnapshot); return newSnapshot; }
java
private CounterSnapshot refreshCounterSnapshot(String counterId) throws IOException { final CounterSnapshot newSnapshot = counterSnapshotFactory.create(counterId); inMemSnapshot.put(counterId, newSnapshot); return newSnapshot; }
[ "private", "CounterSnapshot", "refreshCounterSnapshot", "(", "String", "counterId", ")", "throws", "IOException", "{", "final", "CounterSnapshot", "newSnapshot", "=", "counterSnapshotFactory", ".", "create", "(", "counterId", ")", ";", "inMemSnapshot", ".", "put", "("...
Update cached snapshot with most recent state of counter in Datastore.
[ "Update", "cached", "snapshot", "with", "most", "recent", "state", "of", "counter", "in", "Datastore", "." ]
0d63999beeb93a17447e3bbccaa62175b74cf6e4
https://github.com/spotify/styx/blob/0d63999beeb93a17447e3bbccaa62175b74cf6e4/styx-service-common/src/main/java/com/spotify/styx/util/ShardedCounter.java#L198-L202
117,355
spotify/styx
styx-service-common/src/main/java/com/spotify/styx/util/ShardedCounter.java
ShardedCounter.updateCounter
public void updateCounter(StorageTransaction transaction, String counterId, long delta) throws IOException { CounterSnapshot snapshot = getCounterSnapshot(counterId); // If delta is negative, try to update shards with excess usage first if (delta < 0) { Optional<Integer> shardIndex = snapshot.pickSha...
java
public void updateCounter(StorageTransaction transaction, String counterId, long delta) throws IOException { CounterSnapshot snapshot = getCounterSnapshot(counterId); // If delta is negative, try to update shards with excess usage first if (delta < 0) { Optional<Integer> shardIndex = snapshot.pickSha...
[ "public", "void", "updateCounter", "(", "StorageTransaction", "transaction", ",", "String", "counterId", ",", "long", "delta", ")", "throws", "IOException", "{", "CounterSnapshot", "snapshot", "=", "getCounterSnapshot", "(", "counterId", ")", ";", "// If delta is nega...
Must be called within a TransactionCallable. Augments the transaction with certain operations that strongly consistently increment resp. decrement the counter referred to by counterId, and cause the transaction to fail to commit if the counter's associated limit is exceeded. Also spurious failures are possible. <p>Del...
[ "Must", "be", "called", "within", "a", "TransactionCallable", ".", "Augments", "the", "transaction", "with", "certain", "operations", "that", "strongly", "consistently", "increment", "resp", ".", "decrement", "the", "counter", "referred", "to", "by", "counterId", ...
0d63999beeb93a17447e3bbccaa62175b74cf6e4
https://github.com/spotify/styx/blob/0d63999beeb93a17447e3bbccaa62175b74cf6e4/styx-service-common/src/main/java/com/spotify/styx/util/ShardedCounter.java#L250-L265
117,356
spotify/styx
styx-service-common/src/main/java/com/spotify/styx/util/ShardedCounterSnapshotFactory.java
ShardedCounterSnapshotFactory.initialize
private static void initialize(Storage storage, String counterId) { LOG.debug("Initializing counter shards for resource {}", counterId); for (int startIndex = 0; startIndex < NUM_SHARDS; startIndex += TRANSACTION_GROUP_SIZE) { initShardRange(storage, counterId, startIndex, Math.min(NU...
java
private static void initialize(Storage storage, String counterId) { LOG.debug("Initializing counter shards for resource {}", counterId); for (int startIndex = 0; startIndex < NUM_SHARDS; startIndex += TRANSACTION_GROUP_SIZE) { initShardRange(storage, counterId, startIndex, Math.min(NU...
[ "private", "static", "void", "initialize", "(", "Storage", "storage", ",", "String", "counterId", ")", "{", "LOG", ".", "debug", "(", "\"Initializing counter shards for resource {}\"", ",", "counterId", ")", ";", "for", "(", "int", "startIndex", "=", "0", ";", ...
Idempotent initialization, so that we don't reset an existing shard to zero - counterId may have already been initialized and incremented by another process.
[ "Idempotent", "initialization", "so", "that", "we", "don", "t", "reset", "an", "existing", "shard", "to", "zero", "-", "counterId", "may", "have", "already", "been", "initialized", "and", "incremented", "by", "another", "process", "." ]
0d63999beeb93a17447e3bbccaa62175b74cf6e4
https://github.com/spotify/styx/blob/0d63999beeb93a17447e3bbccaa62175b74cf6e4/styx-service-common/src/main/java/com/spotify/styx/util/ShardedCounterSnapshotFactory.java#L72-L78
117,357
spotify/styx
styx-service-common/src/main/java/com/spotify/styx/storage/DatastoreStorage.java
DatastoreStorage.readActiveStates
Map<WorkflowInstance, RunState> readActiveStates() throws IOException { var timeout = CompletableFuture.runAsync(() -> {}, delayedExecutor(30, SECONDS)); var instances = listActiveInstances0(timeout); // Strongly consistently read values for the instances in parallel var states = gatherIO(Lists.partit...
java
Map<WorkflowInstance, RunState> readActiveStates() throws IOException { var timeout = CompletableFuture.runAsync(() -> {}, delayedExecutor(30, SECONDS)); var instances = listActiveInstances0(timeout); // Strongly consistently read values for the instances in parallel var states = gatherIO(Lists.partit...
[ "Map", "<", "WorkflowInstance", ",", "RunState", ">", "readActiveStates", "(", ")", "throws", "IOException", "{", "var", "timeout", "=", "CompletableFuture", ".", "runAsync", "(", "(", ")", "->", "{", "}", ",", "delayedExecutor", "(", "30", ",", "SECONDS", ...
Strongly consistently read all active states
[ "Strongly", "consistently", "read", "all", "active", "states" ]
0d63999beeb93a17447e3bbccaa62175b74cf6e4
https://github.com/spotify/styx/blob/0d63999beeb93a17447e3bbccaa62175b74cf6e4/styx-service-common/src/main/java/com/spotify/styx/storage/DatastoreStorage.java#L413-L429
117,358
spotify/styx
styx-service-common/src/main/java/com/spotify/styx/storage/DatastoreStorage.java
DatastoreStorage.deleteResource
void deleteResource(String id) throws IOException { storeWithRetries(() -> { datastore.delete(datastore.newKeyFactory().setKind(KIND_COUNTER_LIMIT).newKey(id)); return null; }); deleteShardsForCounter(id); }
java
void deleteResource(String id) throws IOException { storeWithRetries(() -> { datastore.delete(datastore.newKeyFactory().setKind(KIND_COUNTER_LIMIT).newKey(id)); return null; }); deleteShardsForCounter(id); }
[ "void", "deleteResource", "(", "String", "id", ")", "throws", "IOException", "{", "storeWithRetries", "(", "(", ")", "->", "{", "datastore", ".", "delete", "(", "datastore", ".", "newKeyFactory", "(", ")", ".", "setKind", "(", "KIND_COUNTER_LIMIT", ")", ".",...
Delete resource by id. Deletes both counter shards and counter limit if it exists. <p>Due to Datastore limitations (modify max 25 entity groups per transaction), we cannot do everything in one transaction.
[ "Delete", "resource", "by", "id", ".", "Deletes", "both", "counter", "shards", "and", "counter", "limit", "if", "it", "exists", "." ]
0d63999beeb93a17447e3bbccaa62175b74cf6e4
https://github.com/spotify/styx/blob/0d63999beeb93a17447e3bbccaa62175b74cf6e4/styx-service-common/src/main/java/com/spotify/styx/storage/DatastoreStorage.java#L779-L785
117,359
spotify/styx
styx-common/src/main/java/com/spotify/styx/util/FutureUtil.java
FutureUtil.gatherIO
public static <T> List<T> gatherIO(List<? extends CompletableFuture<? extends T>> futures, CompletionStage<Void> timeout) throws IOException { // Apply timeout timeout.thenRun(() -> futures.forEach(f -> f.completeExceptionally(new TimeoutException()))); // Collect ...
java
public static <T> List<T> gatherIO(List<? extends CompletableFuture<? extends T>> futures, CompletionStage<Void> timeout) throws IOException { // Apply timeout timeout.thenRun(() -> futures.forEach(f -> f.completeExceptionally(new TimeoutException()))); // Collect ...
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "gatherIO", "(", "List", "<", "?", "extends", "CompletableFuture", "<", "?", "extends", "T", ">", ">", "futures", ",", "CompletionStage", "<", "Void", ">", "timeout", ")", "throws", "IOException",...
Gathers results from futures that may fail with IOExceptions. @param timeout A global timeout. All futures must have completed before this future completes. Any future not yet completed will be cancelled. @return The values of all futures, in the same order. @throws IOException if interrupted or any of the futures time...
[ "Gathers", "results", "from", "futures", "that", "may", "fail", "with", "IOExceptions", "." ]
0d63999beeb93a17447e3bbccaa62175b74cf6e4
https://github.com/spotify/styx/blob/0d63999beeb93a17447e3bbccaa62175b74cf6e4/styx-common/src/main/java/com/spotify/styx/util/FutureUtil.java#L45-L69
117,360
spotify/styx
styx-service-common/src/main/java/com/spotify/styx/api/RequestAuthenticator.java
RequestAuthenticator.authenticate
public AuthContext authenticate(Request request) { final boolean hasAuthHeader = request.header(HttpHeaders.AUTHORIZATION).isPresent(); if (!hasAuthHeader) { return Optional::empty; } final String authHeader = request.header(HttpHeaders.AUTHORIZATION).get(); if (!authHeader.startsWith(BEARER...
java
public AuthContext authenticate(Request request) { final boolean hasAuthHeader = request.header(HttpHeaders.AUTHORIZATION).isPresent(); if (!hasAuthHeader) { return Optional::empty; } final String authHeader = request.header(HttpHeaders.AUTHORIZATION).get(); if (!authHeader.startsWith(BEARER...
[ "public", "AuthContext", "authenticate", "(", "Request", "request", ")", "{", "final", "boolean", "hasAuthHeader", "=", "request", ".", "header", "(", "HttpHeaders", ".", "AUTHORIZATION", ")", ".", "isPresent", "(", ")", ";", "if", "(", "!", "hasAuthHeader", ...
Authentication an incoming Styx API request. @param request The incoming request. @return A {@link AuthContext} with the authentication result. @throws ResponseException If the Authorization header does not have a Bearer prefix or if the token was invalid.
[ "Authentication", "an", "incoming", "Styx", "API", "request", "." ]
0d63999beeb93a17447e3bbccaa62175b74cf6e4
https://github.com/spotify/styx/blob/0d63999beeb93a17447e3bbccaa62175b74cf6e4/styx-service-common/src/main/java/com/spotify/styx/api/RequestAuthenticator.java#L51-L78
117,361
spotify/helios
helios-tools/src/main/java/com/spotify/helios/cli/command/JobCreateCommand.java
JobCreateCommand.defaultMetadata
private Map<String, String> defaultMetadata() { final Builder<String, String> builder = ImmutableMap.builder(); final Map<String, String> envVars = envVarSupplier.get(); for (final Map.Entry<String, String> entry : DEFAULT_METADATA_ENVVARS.entrySet()) { final String envKey = entry.getKey(); f...
java
private Map<String, String> defaultMetadata() { final Builder<String, String> builder = ImmutableMap.builder(); final Map<String, String> envVars = envVarSupplier.get(); for (final Map.Entry<String, String> entry : DEFAULT_METADATA_ENVVARS.entrySet()) { final String envKey = entry.getKey(); f...
[ "private", "Map", "<", "String", ",", "String", ">", "defaultMetadata", "(", ")", "{", "final", "Builder", "<", "String", ",", "String", ">", "builder", "=", "ImmutableMap", ".", "builder", "(", ")", ";", "final", "Map", "<", "String", ",", "String", "...
Metadata to associate with jobs by default. Currently sets some metadata based upon environment variables set when the CLI command is run.
[ "Metadata", "to", "associate", "with", "jobs", "by", "default", ".", "Currently", "sets", "some", "metadata", "based", "upon", "environment", "variables", "set", "when", "the", "CLI", "command", "is", "run", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-tools/src/main/java/com/spotify/helios/cli/command/JobCreateCommand.java#L631-L648
117,362
spotify/helios
helios-services/src/main/java/com/spotify/helios/servicescommon/ZooKeeperRegistrarUtil.java
ZooKeeperRegistrarUtil.reRegisterHost
public static void reRegisterHost(final ZooKeeperClient client, final String host, final String hostId) throws HostNotFoundException, KeeperException { // * Delete everything in the /status/hosts/<hostname> subtree // * Don't delete any history for the job (on the host)...
java
public static void reRegisterHost(final ZooKeeperClient client, final String host, final String hostId) throws HostNotFoundException, KeeperException { // * Delete everything in the /status/hosts/<hostname> subtree // * Don't delete any history for the job (on the host)...
[ "public", "static", "void", "reRegisterHost", "(", "final", "ZooKeeperClient", "client", ",", "final", "String", "host", ",", "final", "String", "hostId", ")", "throws", "HostNotFoundException", ",", "KeeperException", "{", "// * Delete everything in the /status/hosts/<ho...
Re-register an agent with a different host id. Will remove the existing status of the agent but preserve any jobs deployed to the host and their history. @param client ZooKeeperClient @param host Host @param hostId ID of the host @throws HostNotFoundException If the hostname we are trying to re-register as doesn't ...
[ "Re", "-", "register", "an", "agent", "with", "a", "different", "host", "id", ".", "Will", "remove", "the", "existing", "status", "of", "the", "agent", "but", "preserve", "any", "jobs", "deployed", "to", "the", "host", "and", "their", "history", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/servicescommon/ZooKeeperRegistrarUtil.java#L87-L121
117,363
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/resources/MastersResource.java
MastersResource.list
@GET @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public List<String> list() { return model.getRunningMasters(); }
java
@GET @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public List<String> list() { return model.getRunningMasters(); }
[ "@", "GET", "@", "Produces", "(", "APPLICATION_JSON", ")", "@", "Timed", "@", "ExceptionMetered", "public", "List", "<", "String", ">", "list", "(", ")", "{", "return", "model", ".", "getRunningMasters", "(", ")", ";", "}" ]
Returns a list of names of running Helios masters. @return The list of names.
[ "Returns", "a", "list", "of", "names", "of", "running", "Helios", "masters", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/resources/MastersResource.java#L47-L53
117,364
spotify/helios
helios-services/src/main/java/com/spotify/helios/agent/ZooKeeperAgentModel.java
ZooKeeperAgentModel.addListener
@Override public void addListener(final AgentModel.Listener listener) { listeners.add(listener); listener.tasksChanged(this); }
java
@Override public void addListener(final AgentModel.Listener listener) { listeners.add(listener); listener.tasksChanged(this); }
[ "@", "Override", "public", "void", "addListener", "(", "final", "AgentModel", ".", "Listener", "listener", ")", "{", "listeners", ".", "add", "(", "listener", ")", ";", "listener", ".", "tasksChanged", "(", "this", ")", ";", "}" ]
Add a listener that will be notified when tasks are changed.
[ "Add", "a", "listener", "that", "will", "be", "notified", "when", "tasks", "are", "changed", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/agent/ZooKeeperAgentModel.java#L204-L208
117,365
spotify/helios
helios-client/src/main/java/com/spotify/helios/common/descriptors/RolloutOptions.java
RolloutOptions.withFallback
public RolloutOptions withFallback(final RolloutOptions that) { return RolloutOptions.newBuilder() .setTimeout(firstNonNull(timeout, that.timeout)) .setParallelism(firstNonNull(parallelism, that.parallelism)) .setMigrate(firstNonNull(migrate, that.migrate)) .setOverlap(firstNonNull(o...
java
public RolloutOptions withFallback(final RolloutOptions that) { return RolloutOptions.newBuilder() .setTimeout(firstNonNull(timeout, that.timeout)) .setParallelism(firstNonNull(parallelism, that.parallelism)) .setMigrate(firstNonNull(migrate, that.migrate)) .setOverlap(firstNonNull(o...
[ "public", "RolloutOptions", "withFallback", "(", "final", "RolloutOptions", "that", ")", "{", "return", "RolloutOptions", ".", "newBuilder", "(", ")", ".", "setTimeout", "(", "firstNonNull", "(", "timeout", ",", "that", ".", "timeout", ")", ")", ".", "setParal...
Return a new RolloutOptions instance by merging this instance with another one. @throws NullPointerException if any attribute in both instances are null.
[ "Return", "a", "new", "RolloutOptions", "instance", "by", "merging", "this", "instance", "with", "another", "one", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-client/src/main/java/com/spotify/helios/common/descriptors/RolloutOptions.java#L108-L117
117,366
spotify/helios
helios-tools/src/main/java/com/spotify/helios/cli/CliParser.java
CliParser.handleError
@SuppressWarnings("UseOfSystemOutOrSystemErr") private void handleError(ArgumentParser parser, ArgumentParserException ex) { System.err.println("# " + HELP_ISSUES); System.err.println("# " + HELP_WIKI); System.err.println("# ---------------------------------------------------------------"); parser.han...
java
@SuppressWarnings("UseOfSystemOutOrSystemErr") private void handleError(ArgumentParser parser, ArgumentParserException ex) { System.err.println("# " + HELP_ISSUES); System.err.println("# " + HELP_WIKI); System.err.println("# ---------------------------------------------------------------"); parser.han...
[ "@", "SuppressWarnings", "(", "\"UseOfSystemOutOrSystemErr\"", ")", "private", "void", "handleError", "(", "ArgumentParser", "parser", ",", "ArgumentParserException", "ex", ")", "{", "System", ".", "err", ".", "println", "(", "\"# \"", "+", "HELP_ISSUES", ")", ";"...
Use this instead of calling parser.handle error directly. This will print a header with links to jira and documentation before the standard error message is printed. @param parser the parser which will print the standard error message @param ex the exception that will be printed
[ "Use", "this", "instead", "of", "calling", "parser", ".", "handle", "error", "directly", ".", "This", "will", "print", "a", "header", "with", "links", "to", "jira", "and", "documentation", "before", "the", "standard", "error", "message", "is", "printed", "."...
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-tools/src/main/java/com/spotify/helios/cli/CliParser.java#L241-L247
117,367
spotify/helios
helios-services/src/main/java/com/spotify/helios/servicescommon/coordination/PersistentPathChildrenCache.java
PersistentPathChildrenCache.sync
private Map<String, T> sync() throws KeeperException { log.debug("syncing: {}", path); final Map<String, T> newSnapshot = Maps.newHashMap(); // Fetch new snapshot and register watchers try { final List<String> children = getChildren(); log.debug("children: {}", children); for (final ...
java
private Map<String, T> sync() throws KeeperException { log.debug("syncing: {}", path); final Map<String, T> newSnapshot = Maps.newHashMap(); // Fetch new snapshot and register watchers try { final List<String> children = getChildren(); log.debug("children: {}", children); for (final ...
[ "private", "Map", "<", "String", ",", "T", ">", "sync", "(", ")", "throws", "KeeperException", "{", "log", ".", "debug", "(", "\"syncing: {}\"", ",", "path", ")", ";", "final", "Map", "<", "String", ",", "T", ">", "newSnapshot", "=", "Maps", ".", "ne...
Fetch new snapshot and register watchers.
[ "Fetch", "new", "snapshot", "and", "register", "watchers", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/servicescommon/coordination/PersistentPathChildrenCache.java#L232-L266
117,368
spotify/helios
helios-services/src/main/java/com/spotify/helios/servicescommon/ResolverConfReader.java
ResolverConfReader.getDomainFromResolverConf
public static String getDomainFromResolverConf(final String file) { try (final InputStream in = new FileInputStream(file)) { final InputStreamReader isr = new InputStreamReader(in); try (final BufferedReader br = new BufferedReader(isr)) { String line; while ((line = br.readLine()) != nu...
java
public static String getDomainFromResolverConf(final String file) { try (final InputStream in = new FileInputStream(file)) { final InputStreamReader isr = new InputStreamReader(in); try (final BufferedReader br = new BufferedReader(isr)) { String line; while ((line = br.readLine()) != nu...
[ "public", "static", "String", "getDomainFromResolverConf", "(", "final", "String", "file", ")", "{", "try", "(", "final", "InputStream", "in", "=", "new", "FileInputStream", "(", "file", ")", ")", "{", "final", "InputStreamReader", "isr", "=", "new", "InputStr...
Looks in file to find the domain setting. @param file path to resolver config file @return the domain specified there, or empty string if any failure
[ "Looks", "in", "file", "to", "find", "the", "domain", "setting", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/servicescommon/ResolverConfReader.java#L46-L68
117,369
spotify/helios
helios-tools/src/main/java/com/spotify/helios/cli/Target.java
Target.from
public static List<Target> from(final String srvName, final Iterable<String> domains) { final ImmutableList.Builder<Target> builder = ImmutableList.builder(); for (final String domain : domains) { builder.add(new SrvTarget(srvName, domain)); } return builder.build(); }
java
public static List<Target> from(final String srvName, final Iterable<String> domains) { final ImmutableList.Builder<Target> builder = ImmutableList.builder(); for (final String domain : domains) { builder.add(new SrvTarget(srvName, domain)); } return builder.build(); }
[ "public", "static", "List", "<", "Target", ">", "from", "(", "final", "String", "srvName", ",", "final", "Iterable", "<", "String", ">", "domains", ")", "{", "final", "ImmutableList", ".", "Builder", "<", "Target", ">", "builder", "=", "ImmutableList", "."...
Create targets for a list of domains. @param srvName The SRV name. @param domains A list of domains. @return A list of targets.
[ "Create", "targets", "for", "a", "list", "of", "domains", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-tools/src/main/java/com/spotify/helios/cli/Target.java#L167-L173
117,370
spotify/helios
helios-tools/src/main/java/com/spotify/helios/cli/command/ControlCommand.java
ControlCommand.run
private boolean run(final Namespace options, final Target target, final PrintStream out, final PrintStream err, final String username, final boolean json, final BufferedReader stdin) throws Exception { final HeliosClient client = Utils.getClient(target, err, userna...
java
private boolean run(final Namespace options, final Target target, final PrintStream out, final PrintStream err, final String username, final boolean json, final BufferedReader stdin) throws Exception { final HeliosClient client = Utils.getClient(target, err, userna...
[ "private", "boolean", "run", "(", "final", "Namespace", "options", ",", "final", "Target", "target", ",", "final", "PrintStream", "out", ",", "final", "PrintStream", "err", ",", "final", "String", "username", ",", "final", "boolean", "json", ",", "final", "B...
Execute against a cluster at a specific endpoint.
[ "Execute", "against", "a", "cluster", "at", "a", "specific", "endpoint", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-tools/src/main/java/com/spotify/helios/cli/command/ControlCommand.java#L114-L141
117,371
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.getRunningMasters
@Override public List<String> getRunningMasters() { final ZooKeeperClient client = provider.get("getRunningMasters"); try { final List<String> masters = client.getChildren(Paths.statusMaster()); final ImmutableList.Builder<String> upMasters = ImmutableList.builder(); for (final String master...
java
@Override public List<String> getRunningMasters() { final ZooKeeperClient client = provider.get("getRunningMasters"); try { final List<String> masters = client.getChildren(Paths.statusMaster()); final ImmutableList.Builder<String> upMasters = ImmutableList.builder(); for (final String master...
[ "@", "Override", "public", "List", "<", "String", ">", "getRunningMasters", "(", ")", "{", "final", "ZooKeeperClient", "client", "=", "provider", ".", "get", "(", "\"getRunningMasters\"", ")", ";", "try", "{", "final", "List", "<", "String", ">", "masters", ...
Returns a list of the host names of the currently running masters.
[ "Returns", "a", "list", "of", "the", "host", "names", "of", "the", "currently", "running", "masters", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L218-L233
117,372
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.addJob
@Override public void addJob(final Job job) throws JobExistsException { log.info("adding job: {}", job); final JobId id = job.getId(); final UUID operationId = UUID.randomUUID(); final String creationPath = Paths.configJobCreation(id, operationId); final ZooKeeperClient client = provider.get("addJ...
java
@Override public void addJob(final Job job) throws JobExistsException { log.info("adding job: {}", job); final JobId id = job.getId(); final UUID operationId = UUID.randomUUID(); final String creationPath = Paths.configJobCreation(id, operationId); final ZooKeeperClient client = provider.get("addJ...
[ "@", "Override", "public", "void", "addJob", "(", "final", "Job", "job", ")", "throws", "JobExistsException", "{", "log", ".", "info", "(", "\"adding job: {}\"", ",", "job", ")", ";", "final", "JobId", "id", "=", "job", ".", "getId", "(", ")", ";", "fi...
Adds a job into the configuration.
[ "Adds", "a", "job", "into", "the", "configuration", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L249-L279
117,373
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.getJobHistory
@Override public List<TaskStatusEvent> getJobHistory(final JobId jobId) throws JobDoesNotExistException { return getJobHistory(jobId, null); }
java
@Override public List<TaskStatusEvent> getJobHistory(final JobId jobId) throws JobDoesNotExistException { return getJobHistory(jobId, null); }
[ "@", "Override", "public", "List", "<", "TaskStatusEvent", ">", "getJobHistory", "(", "final", "JobId", "jobId", ")", "throws", "JobDoesNotExistException", "{", "return", "getJobHistory", "(", "jobId", ",", "null", ")", ";", "}" ]
Given a jobId, returns the N most recent events in its history in the cluster.
[ "Given", "a", "jobId", "returns", "the", "N", "most", "recent", "events", "in", "its", "history", "in", "the", "cluster", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L284-L287
117,374
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.getJobHistory
@Override public List<TaskStatusEvent> getJobHistory(final JobId jobId, final String host) throws JobDoesNotExistException { final Job descriptor = getJob(jobId); if (descriptor == null) { throw new JobDoesNotExistException(jobId); } final ZooKeeperClient client = provider.get("getJobHisto...
java
@Override public List<TaskStatusEvent> getJobHistory(final JobId jobId, final String host) throws JobDoesNotExistException { final Job descriptor = getJob(jobId); if (descriptor == null) { throw new JobDoesNotExistException(jobId); } final ZooKeeperClient client = provider.get("getJobHisto...
[ "@", "Override", "public", "List", "<", "TaskStatusEvent", ">", "getJobHistory", "(", "final", "JobId", "jobId", ",", "final", "String", "host", ")", "throws", "JobDoesNotExistException", "{", "final", "Job", "descriptor", "=", "getJob", "(", "jobId", ")", ";"...
Given a jobId and host, returns the N most recent events in its history on that host in the cluster.
[ "Given", "a", "jobId", "and", "host", "returns", "the", "N", "most", "recent", "events", "in", "its", "history", "on", "that", "host", "in", "the", "cluster", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L293-L338
117,375
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.addDeploymentGroup
@Override public void addDeploymentGroup(final DeploymentGroup deploymentGroup) throws DeploymentGroupExistsException { log.info("adding deployment-group: {}", deploymentGroup); final ZooKeeperClient client = provider.get("addDeploymentGroup"); try { try { client.ensurePath(Paths.conf...
java
@Override public void addDeploymentGroup(final DeploymentGroup deploymentGroup) throws DeploymentGroupExistsException { log.info("adding deployment-group: {}", deploymentGroup); final ZooKeeperClient client = provider.get("addDeploymentGroup"); try { try { client.ensurePath(Paths.conf...
[ "@", "Override", "public", "void", "addDeploymentGroup", "(", "final", "DeploymentGroup", "deploymentGroup", ")", "throws", "DeploymentGroupExistsException", "{", "log", ".", "info", "(", "\"adding deployment-group: {}\"", ",", "deploymentGroup", ")", ";", "final", "Zoo...
Create a deployment group. <p>If successful, the following ZK nodes will be created: <ul> <li>/config/deployment-groups/[group-name]</li> <li>/status/deployment-groups/[group-name]</li> <li>/status/deployment-groups/[group-name]/hosts</li> </ul> These nodes are guaranteed to exist until the DG is removed. <p>If the o...
[ "Create", "a", "deployment", "group", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L356-L380
117,376
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.removeDeploymentGroup
@Override public void removeDeploymentGroup(final String name) throws DeploymentGroupDoesNotExistException { log.info("removing deployment-group: name={}", name); final ZooKeeperClient client = provider.get("removeDeploymentGroup"); try { client.ensurePath(Paths.configDeploymentGroups()); clie...
java
@Override public void removeDeploymentGroup(final String name) throws DeploymentGroupDoesNotExistException { log.info("removing deployment-group: name={}", name); final ZooKeeperClient client = provider.get("removeDeploymentGroup"); try { client.ensurePath(Paths.configDeploymentGroups()); clie...
[ "@", "Override", "public", "void", "removeDeploymentGroup", "(", "final", "String", "name", ")", "throws", "DeploymentGroupDoesNotExistException", "{", "log", ".", "info", "(", "\"removing deployment-group: name={}\"", ",", "name", ")", ";", "final", "ZooKeeperClient", ...
Remove a deployment group. <p>If successful, all ZK nodes associated with the DG will be deleted. Specifically these nodes are guaranteed to be non-existent after a successful remove (not all of them might exist before, though): <ul> <li>/config/deployment-groups/[group-name]</li> <li>/status/deployment-groups/[group-...
[ "Remove", "a", "deployment", "group", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L419-L465
117,377
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.updateOnHostChange
private boolean updateOnHostChange(final DeploymentGroup group, final DeploymentGroupStatus status) { if (status == null) { // We're in an unknown state. Go hog wild. return true; } if (group.getRollingUpdateReason() == null) { // The last rolling upda...
java
private boolean updateOnHostChange(final DeploymentGroup group, final DeploymentGroupStatus status) { if (status == null) { // We're in an unknown state. Go hog wild. return true; } if (group.getRollingUpdateReason() == null) { // The last rolling upda...
[ "private", "boolean", "updateOnHostChange", "(", "final", "DeploymentGroup", "group", ",", "final", "DeploymentGroupStatus", "status", ")", "{", "if", "(", "status", "==", "null", ")", "{", "// We're in an unknown state. Go hog wild.", "return", "true", ";", "}", "i...
Determines whether we should trigger a rolling update when deployment group hosts change. <p>We want to avoid triggering an automatic rolling update if the most recent rolling update was triggered manually, and failed. @param group The deployment group that is changing hosts. @param status The status of the aforemen...
[ "Determines", "whether", "we", "should", "trigger", "a", "rolling", "update", "when", "deployment", "group", "hosts", "change", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L505-L524
117,378
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.redundantUndeployment
private boolean redundantUndeployment(final Deployment deployment, final DeploymentGroup deploymentGroup) { // This deployment was not created by this deployment group. if (!Objects.equals(deployment.getDeploymentGroupName(), deploymentGroup.getName())) { return fal...
java
private boolean redundantUndeployment(final Deployment deployment, final DeploymentGroup deploymentGroup) { // This deployment was not created by this deployment group. if (!Objects.equals(deployment.getDeploymentGroupName(), deploymentGroup.getName())) { return fal...
[ "private", "boolean", "redundantUndeployment", "(", "final", "Deployment", "deployment", ",", "final", "DeploymentGroup", "deploymentGroup", ")", "{", "// This deployment was not created by this deployment group.", "if", "(", "!", "Objects", ".", "equals", "(", "deployment"...
redundantDeployment determines whether or not rollingUpdateUndeploy should actually emit RollingUpdateOps to undeploy a job. <p>Jobs are undeployed in two cases: <p>1. During a rolling update 2. When a host leaves a deployment group <p>In case 1. this redundancy check makes sense. The undeployment of a job during a ...
[ "redundantDeployment", "determines", "whether", "or", "not", "rollingUpdateUndeploy", "should", "actually", "emit", "RollingUpdateOps", "to", "undeploy", "a", "job", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L1161-L1181
117,379
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.removeJob
@Override public Job removeJob(final JobId id, final String token) throws JobDoesNotExistException, JobStillDeployedException, TokenVerificationException { log.info("removing job: id={}", id); final ZooKeeperClient client = provider.get("removeJob"); final Job job = getJob(client, id); if (job =...
java
@Override public Job removeJob(final JobId id, final String token) throws JobDoesNotExistException, JobStillDeployedException, TokenVerificationException { log.info("removing job: id={}", id); final ZooKeeperClient client = provider.get("removeJob"); final Job job = getJob(client, id); if (job =...
[ "@", "Override", "public", "Job", "removeJob", "(", "final", "JobId", "id", ",", "final", "String", "token", ")", "throws", "JobDoesNotExistException", ",", "JobStillDeployedException", ",", "TokenVerificationException", "{", "log", ".", "info", "(", "\"removing job...
Deletes a job from ZooKeeper. Ensures that job is not currently running anywhere.
[ "Deletes", "a", "job", "from", "ZooKeeper", ".", "Ensures", "that", "job", "is", "not", "currently", "running", "anywhere", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L1453-L1496
117,380
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.updateDeployment
@Override public void updateDeployment(final String host, final Deployment deployment, final String token) throws HostNotFoundException, JobNotDeployedException, TokenVerificationException { log.info("updating deployment {}: {}", deployment, host); final ZooKeeperClient client = provider.get("updateDep...
java
@Override public void updateDeployment(final String host, final Deployment deployment, final String token) throws HostNotFoundException, JobNotDeployedException, TokenVerificationException { log.info("updating deployment {}: {}", deployment, host); final ZooKeeperClient client = provider.get("updateDep...
[ "@", "Override", "public", "void", "updateDeployment", "(", "final", "String", "host", ",", "final", "Deployment", "deployment", ",", "final", "String", "token", ")", "throws", "HostNotFoundException", ",", "JobNotDeployedException", ",", "TokenVerificationException", ...
Used to update the existing deployment of a job.
[ "Used", "to", "update", "the", "existing", "deployment", "of", "a", "job", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L1667-L1697
117,381
spotify/helios
helios-services/src/main/java/com/spotify/helios/agent/Supervisor.java
Supervisor.close
public void close() { reactor.stopAsync(); if (runner != null) { runner.stopAsync(); } metrics.supervisorClosed(); monitor.close(); }
java
public void close() { reactor.stopAsync(); if (runner != null) { runner.stopAsync(); } metrics.supervisorClosed(); monitor.close(); }
[ "public", "void", "close", "(", ")", "{", "reactor", ".", "stopAsync", "(", ")", ";", "if", "(", "runner", "!=", "null", ")", "{", "runner", ".", "stopAsync", "(", ")", ";", "}", "metrics", ".", "supervisorClosed", "(", ")", ";", "monitor", ".", "c...
Close this supervisor. The actual container is left as-is.
[ "Close", "this", "supervisor", ".", "The", "actual", "container", "is", "left", "as", "-", "is", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/agent/Supervisor.java#L122-L129
117,382
spotify/helios
helios-services/src/main/java/com/spotify/helios/agent/PortAllocator.java
PortAllocator.allocate
public Map<String, Integer> allocate(final Map<String, PortMapping> ports, final Set<Integer> used) { return allocate0(ports, Sets.newHashSet(used)); }
java
public Map<String, Integer> allocate(final Map<String, PortMapping> ports, final Set<Integer> used) { return allocate0(ports, Sets.newHashSet(used)); }
[ "public", "Map", "<", "String", ",", "Integer", ">", "allocate", "(", "final", "Map", "<", "String", ",", "PortMapping", ">", "ports", ",", "final", "Set", "<", "Integer", ">", "used", ")", "{", "return", "allocate0", "(", "ports", ",", "Sets", ".", ...
Allocate ports for port mappings with no external ports configured. @param ports A map of port mappings for a container, both with statically configured external ports and dynamic unconfigured external ports. @param used A set of used ports. The ports allocated will not clash with these ports. @return The allocated ...
[ "Allocate", "ports", "for", "port", "mappings", "with", "no", "external", "ports", "configured", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/agent/PortAllocator.java#L67-L70
117,383
spotify/helios
helios-services/src/main/java/com/spotify/helios/agent/PortAllocator.java
PortAllocator.portAvailable
private boolean portAvailable(final int port) { ServerSocket socket = null; try { socket = new ServerSocket(port); return true; } catch (IOException ignored) { return false; } finally { if (socket != null) { try { socket.close(); } catch (IOException e) ...
java
private boolean portAvailable(final int port) { ServerSocket socket = null; try { socket = new ServerSocket(port); return true; } catch (IOException ignored) { return false; } finally { if (socket != null) { try { socket.close(); } catch (IOException e) ...
[ "private", "boolean", "portAvailable", "(", "final", "int", "port", ")", "{", "ServerSocket", "socket", "=", "null", ";", "try", "{", "socket", "=", "new", "ServerSocket", "(", "port", ")", ";", "return", "true", ";", "}", "catch", "(", "IOException", "i...
Check if the port is available on the host. This is racy but it's better than nothing. @param port Port number to check. @return True if port is available. False otherwise.
[ "Check", "if", "the", "port", "is", "available", "on", "the", "host", ".", "This", "is", "racy", "but", "it", "s", "better", "than", "nothing", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/agent/PortAllocator.java#L142-L158
117,384
spotify/helios
helios-tools/src/main/java/com/spotify/helios/cli/command/HostResolver.java
HostResolver.findMatchesWithLowestScore
private List<String> findMatchesWithLowestScore(final List<ScoredHost> scored) { final int minScore = scored.get(0).score; final ImmutableList.Builder<String> minScoreHosts = ImmutableList.builder(); for (final ScoredHost score : scored) { if (score.score == minScore) { minScoreHosts.add(score...
java
private List<String> findMatchesWithLowestScore(final List<ScoredHost> scored) { final int minScore = scored.get(0).score; final ImmutableList.Builder<String> minScoreHosts = ImmutableList.builder(); for (final ScoredHost score : scored) { if (score.score == minScore) { minScoreHosts.add(score...
[ "private", "List", "<", "String", ">", "findMatchesWithLowestScore", "(", "final", "List", "<", "ScoredHost", ">", "scored", ")", "{", "final", "int", "minScore", "=", "scored", ".", "get", "(", "0", ")", ".", "score", ";", "final", "ImmutableList", ".", ...
Assumes sorted input in scored
[ "Assumes", "sorted", "input", "in", "scored" ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-tools/src/main/java/com/spotify/helios/cli/command/HostResolver.java#L132-L141
117,385
spotify/helios
helios-tools/src/main/java/com/spotify/helios/cli/command/HostResolver.java
HostResolver.scoreMatches
private List<ScoredHost> scoreMatches(final List<String> results) { final ImmutableList.Builder<ScoredHost> scored = ImmutableList.builder(); for (final String name : results) { int score = Integer.MAX_VALUE; for (int i = 0; i < searchPath.length; i++) { if (name.endsWith(searchPath[i].toStr...
java
private List<ScoredHost> scoreMatches(final List<String> results) { final ImmutableList.Builder<ScoredHost> scored = ImmutableList.builder(); for (final String name : results) { int score = Integer.MAX_VALUE; for (int i = 0; i < searchPath.length; i++) { if (name.endsWith(searchPath[i].toStr...
[ "private", "List", "<", "ScoredHost", ">", "scoreMatches", "(", "final", "List", "<", "String", ">", "results", ")", "{", "final", "ImmutableList", ".", "Builder", "<", "ScoredHost", ">", "scored", "=", "ImmutableList", ".", "builder", "(", ")", ";", "for"...
Score matches based upon the position in the dns search domain that matches the result
[ "Score", "matches", "based", "upon", "the", "position", "in", "the", "dns", "search", "domain", "that", "matches", "the", "result" ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-tools/src/main/java/com/spotify/helios/cli/command/HostResolver.java#L144-L158
117,386
spotify/helios
helios-tools/src/main/java/com/spotify/helios/cli/CliConfig.java
CliConfig.fromFile
public static CliConfig fromFile(final File defaultsFile, final Map<String, String> environmentVariables) throws IOException, URISyntaxException { final Config config; if (defaultsFile.exists() && defaultsFile.canRead()) { config = ConfigFactory.parseFile(defaults...
java
public static CliConfig fromFile(final File defaultsFile, final Map<String, String> environmentVariables) throws IOException, URISyntaxException { final Config config; if (defaultsFile.exists() && defaultsFile.canRead()) { config = ConfigFactory.parseFile(defaults...
[ "public", "static", "CliConfig", "fromFile", "(", "final", "File", "defaultsFile", ",", "final", "Map", "<", "String", ",", "String", ">", "environmentVariables", ")", "throws", "IOException", ",", "URISyntaxException", "{", "final", "Config", "config", ";", "if...
Returns a CliConfig instance with values parsed from the specified file. <p>If the file is not found, a CliConfig with pre-defined values will be returned. @param defaultsFile The file to parse from @return The configuration @throws IOException If the file exists but could not be read @throws URISyntaxExcept...
[ "Returns", "a", "CliConfig", "instance", "with", "values", "parsed", "from", "the", "specified", "file", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-tools/src/main/java/com/spotify/helios/cli/CliConfig.java#L127-L138
117,387
spotify/helios
helios-services/src/main/java/com/spotify/helios/agent/SupervisorFactory.java
SupervisorFactory.create
public Supervisor create(final Job job, final String existingContainerId, final Map<String, Integer> ports, final Supervisor.Listener listener) { final RestartPolicy policy = RestartPolicy.newBuilder().build(); final TaskConfig taskConfig = TaskConfig.builde...
java
public Supervisor create(final Job job, final String existingContainerId, final Map<String, Integer> ports, final Supervisor.Listener listener) { final RestartPolicy policy = RestartPolicy.newBuilder().build(); final TaskConfig taskConfig = TaskConfig.builde...
[ "public", "Supervisor", "create", "(", "final", "Job", "job", ",", "final", "String", "existingContainerId", ",", "final", "Map", "<", "String", ",", "Integer", ">", "ports", ",", "final", "Supervisor", ".", "Listener", "listener", ")", "{", "final", "Restar...
Create a new application container. @param job The job definition. @param existingContainerId ID of existing container. @param ports The ports. @param listener The listener. @return A new container.
[ "Create", "a", "new", "application", "container", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/agent/SupervisorFactory.java#L94-L139
117,388
spotify/helios
helios-services/src/main/java/com/spotify/helios/agent/TaskMonitor.java
TaskMonitor.updateThrottle
private boolean updateThrottle() { // Derive new throttle state final ThrottleState newThrottle; final boolean flapping = flapController.isFlapping(); if (imageFailure != null) { // Image failures take precedence newThrottle = imageFailure; } else { newThrottle = flapping ? FLAPPI...
java
private boolean updateThrottle() { // Derive new throttle state final ThrottleState newThrottle; final boolean flapping = flapController.isFlapping(); if (imageFailure != null) { // Image failures take precedence newThrottle = imageFailure; } else { newThrottle = flapping ? FLAPPI...
[ "private", "boolean", "updateThrottle", "(", ")", "{", "// Derive new throttle state", "final", "ThrottleState", "newThrottle", ";", "final", "boolean", "flapping", "=", "flapController", ".", "isFlapping", "(", ")", ";", "if", "(", "imageFailure", "!=", "null", "...
Derive a new throttle state and propagate it if needed. If flapping, schedule a future check to see if we're still flapping and potentially reset the flapping state.
[ "Derive", "a", "new", "throttle", "state", "and", "propagate", "it", "if", "needed", ".", "If", "flapping", "schedule", "a", "future", "check", "to", "see", "if", "we", "re", "still", "flapping", "and", "potentially", "reset", "the", "flapping", "state", "...
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/agent/TaskMonitor.java#L195-L229
117,389
spotify/helios
helios-services/src/main/java/com/spotify/helios/agent/TaskMonitor.java
TaskMonitor.updateState
private void updateState(final TaskStatus.State state) { statusUpdater.setState(state); // Commit and push a new status try { statusUpdater.update(); } catch (InterruptedException e) { // TODO: propagate interrupt instead? Thread.currentThread().interrupt(); } }
java
private void updateState(final TaskStatus.State state) { statusUpdater.setState(state); // Commit and push a new status try { statusUpdater.update(); } catch (InterruptedException e) { // TODO: propagate interrupt instead? Thread.currentThread().interrupt(); } }
[ "private", "void", "updateState", "(", "final", "TaskStatus", ".", "State", "state", ")", "{", "statusUpdater", ".", "setState", "(", "state", ")", ";", "// Commit and push a new status", "try", "{", "statusUpdater", ".", "update", "(", ")", ";", "}", "catch",...
Propagate a new task state by setting it and committing the status update.
[ "Propagate", "a", "new", "task", "state", "by", "setting", "it", "and", "committing", "the", "status", "update", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/agent/TaskMonitor.java#L234-L243
117,390
spotify/helios
helios-services/src/main/java/com/spotify/helios/agent/AgentParser.java
AgentParser.validateArgument
@VisibleForTesting protected static <T> List<T> validateArgument(List<T> list, Predicate<T> predicate, Function<T, String> msgFn) { final Optional<T> firstInvalid = list.stream() .filter(predicate.negate()) .findAny(); if (firstInvalid.isPresen...
java
@VisibleForTesting protected static <T> List<T> validateArgument(List<T> list, Predicate<T> predicate, Function<T, String> msgFn) { final Optional<T> firstInvalid = list.stream() .filter(predicate.negate()) .findAny(); if (firstInvalid.isPresen...
[ "@", "VisibleForTesting", "protected", "static", "<", "T", ">", "List", "<", "T", ">", "validateArgument", "(", "List", "<", "T", ">", "list", ",", "Predicate", "<", "T", ">", "predicate", ",", "Function", "<", "T", ",", "String", ">", "msgFn", ")", ...
Verifies that all entries in the Collection satisfy the predicate. If any do not, throw an IllegalArgumentException with the specified message for the first invalid entry.
[ "Verifies", "that", "all", "entries", "in", "the", "Collection", "satisfy", "the", "predicate", ".", "If", "any", "do", "not", "throw", "an", "IllegalArgumentException", "with", "the", "specified", "message", "for", "the", "first", "invalid", "entry", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/agent/AgentParser.java#L224-L236
117,391
spotify/helios
helios-client/src/main/java/com/spotify/helios/common/JobValidator.java
JobValidator.validateJobImage
private Set<String> validateJobImage(final String image) { final Set<String> errors = Sets.newHashSet(); if (image == null) { errors.add("Image was not specified."); } else { // Validate image name validateImageReference(image, errors); } return errors; }
java
private Set<String> validateJobImage(final String image) { final Set<String> errors = Sets.newHashSet(); if (image == null) { errors.add("Image was not specified."); } else { // Validate image name validateImageReference(image, errors); } return errors; }
[ "private", "Set", "<", "String", ">", "validateJobImage", "(", "final", "String", "image", ")", "{", "final", "Set", "<", "String", ">", "errors", "=", "Sets", ".", "newHashSet", "(", ")", ";", "if", "(", "image", "==", "null", ")", "{", "errors", "....
Validate the Job's image by checking it's not null or empty and has the right format. @param image The image String @return A set of error Strings
[ "Validate", "the", "Job", "s", "image", "by", "checking", "it", "s", "not", "null", "or", "empty", "and", "has", "the", "right", "format", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-client/src/main/java/com/spotify/helios/common/JobValidator.java#L235-L246
117,392
spotify/helios
helios-client/src/main/java/com/spotify/helios/common/JobValidator.java
JobValidator.validateJobId
private Set<String> validateJobId(final Job job) { final Set<String> errors = Sets.newHashSet(); final JobId jobId = job.getId(); if (jobId == null) { errors.add("Job id was not specified."); return errors; } final String jobIdVersion = jobId.getVersion(); final String jobIdHash = ...
java
private Set<String> validateJobId(final Job job) { final Set<String> errors = Sets.newHashSet(); final JobId jobId = job.getId(); if (jobId == null) { errors.add("Job id was not specified."); return errors; } final String jobIdVersion = jobId.getVersion(); final String jobIdHash = ...
[ "private", "Set", "<", "String", ">", "validateJobId", "(", "final", "Job", "job", ")", "{", "final", "Set", "<", "String", ">", "errors", "=", "Sets", ".", "newHashSet", "(", ")", ";", "final", "JobId", "jobId", "=", "job", ".", "getId", "(", ")", ...
Validate the Job's JobId by checking name, version, and hash are not null or empty, don't contain invalid characters. @param job The Job to check. @return A set of error Strings
[ "Validate", "the", "Job", "s", "JobId", "by", "checking", "name", "version", "and", "hash", "are", "not", "null", "or", "empty", "don", "t", "contain", "invalid", "characters", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-client/src/main/java/com/spotify/helios/common/JobValidator.java#L256-L277
117,393
spotify/helios
helios-client/src/main/java/com/spotify/helios/common/JobValidator.java
JobValidator.validateJobHealthCheck
private Set<String> validateJobHealthCheck(final Job job) { final HealthCheck healthCheck = job.getHealthCheck(); if (healthCheck == null) { return emptySet(); } final Set<String> errors = Sets.newHashSet(); if (healthCheck instanceof ExecHealthCheck) { final List<String> command = ((...
java
private Set<String> validateJobHealthCheck(final Job job) { final HealthCheck healthCheck = job.getHealthCheck(); if (healthCheck == null) { return emptySet(); } final Set<String> errors = Sets.newHashSet(); if (healthCheck instanceof ExecHealthCheck) { final List<String> command = ((...
[ "private", "Set", "<", "String", ">", "validateJobHealthCheck", "(", "final", "Job", "job", ")", "{", "final", "HealthCheck", "healthCheck", "=", "job", ".", "getHealthCheck", "(", ")", ";", "if", "(", "healthCheck", "==", "null", ")", "{", "return", "empt...
Validate the Job's health check. @param job The Job to check. @return A set of error Strings
[ "Validate", "the", "Job", "s", "health", "check", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-client/src/main/java/com/spotify/helios/common/JobValidator.java#L525-L557
117,394
spotify/helios
helios-client/src/main/java/com/spotify/helios/common/JobValidator.java
JobValidator.validateJobNetworkMode
private Set<String> validateJobNetworkMode(final Job job) { final String networkMode = job.getNetworkMode(); if (networkMode == null) { return emptySet(); } final Set<String> errors = Sets.newHashSet(); if (!VALID_NETWORK_MODES.contains(networkMode) && !networkMode.startsWith("container:"))...
java
private Set<String> validateJobNetworkMode(final Job job) { final String networkMode = job.getNetworkMode(); if (networkMode == null) { return emptySet(); } final Set<String> errors = Sets.newHashSet(); if (!VALID_NETWORK_MODES.contains(networkMode) && !networkMode.startsWith("container:"))...
[ "private", "Set", "<", "String", ">", "validateJobNetworkMode", "(", "final", "Job", "job", ")", "{", "final", "String", "networkMode", "=", "job", ".", "getNetworkMode", "(", ")", ";", "if", "(", "networkMode", "==", "null", ")", "{", "return", "emptySet"...
Validate the Job's network mode. @param job The Job to check. @return A set of error Strings
[ "Validate", "the", "Job", "s", "network", "mode", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-client/src/main/java/com/spotify/helios/common/JobValidator.java#L566-L582
117,395
spotify/helios
helios-client/src/main/java/com/spotify/helios/common/JobValidator.java
JobValidator.validateAddCapabilities
private Set<String> validateAddCapabilities(final Job job) { final Set<String> caps = job.getAddCapabilities(); if (caps == null) { return emptySet(); } final Set<String> errors = Sets.newHashSet(); final Set<String> disallowedCaps = Sets.difference(caps, whitelistedCapabilities); if (...
java
private Set<String> validateAddCapabilities(final Job job) { final Set<String> caps = job.getAddCapabilities(); if (caps == null) { return emptySet(); } final Set<String> errors = Sets.newHashSet(); final Set<String> disallowedCaps = Sets.difference(caps, whitelistedCapabilities); if (...
[ "private", "Set", "<", "String", ">", "validateAddCapabilities", "(", "final", "Job", "job", ")", "{", "final", "Set", "<", "String", ">", "caps", "=", "job", ".", "getAddCapabilities", "(", ")", ";", "if", "(", "caps", "==", "null", ")", "{", "return"...
Validate the Job's added Linux capabilities. @param job The Job to check. @return A set of error Strings
[ "Validate", "the", "Job", "s", "added", "Linux", "capabilities", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-client/src/main/java/com/spotify/helios/common/JobValidator.java#L591-L610
117,396
spotify/helios
helios-service-registration/src/main/java/com/spotify/helios/serviceregistration/ServiceRegistrarLoader.java
ServiceRegistrarLoader.pluginClassLoader
private static ClassLoader pluginClassLoader(final Path plugin, final ClassLoader environment, final ClassLoader parent) { final URL url; try { url = plugin.toFile().toURI().toURL(); } catch (MalformedURLExce...
java
private static ClassLoader pluginClassLoader(final Path plugin, final ClassLoader environment, final ClassLoader parent) { final URL url; try { url = plugin.toFile().toURI().toURL(); } catch (MalformedURLExce...
[ "private", "static", "ClassLoader", "pluginClassLoader", "(", "final", "Path", "plugin", ",", "final", "ClassLoader", "environment", ",", "final", "ClassLoader", "parent", ")", "{", "final", "URL", "url", ";", "try", "{", "url", "=", "plugin", ".", "toFile", ...
Create a class loader for a plugin jar.
[ "Create", "a", "class", "loader", "for", "a", "plugin", "jar", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-service-registration/src/main/java/com/spotify/helios/serviceregistration/ServiceRegistrarLoader.java#L136-L147
117,397
spotify/helios
helios-services/src/main/java/com/spotify/helios/agent/TaskRunner.java
TaskRunner.unregister
public boolean unregister() { if (serviceRegistrationHandle.isPresent()) { registrar.unregister(serviceRegistrationHandle.get()); serviceRegistrationHandle = Optional.absent(); return true; } return false; }
java
public boolean unregister() { if (serviceRegistrationHandle.isPresent()) { registrar.unregister(serviceRegistrationHandle.get()); serviceRegistrationHandle = Optional.absent(); return true; } return false; }
[ "public", "boolean", "unregister", "(", ")", "{", "if", "(", "serviceRegistrationHandle", ".", "isPresent", "(", ")", ")", "{", "registrar", ".", "unregister", "(", "serviceRegistrationHandle", ".", "get", "(", ")", ")", ";", "serviceRegistrationHandle", "=", ...
Unregister a set of service endpoints previously registered. @return boolean true if service registration handle was present, false otherwise
[ "Unregister", "a", "set", "of", "service", "endpoints", "previously", "registered", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/agent/TaskRunner.java#L99-L106
117,398
spotify/helios
helios-services/src/main/java/com/spotify/helios/agent/TaskRunner.java
TaskRunner.stop
public void stop() throws InterruptedException { // Tell docker to stop or eventually kill the container final String container = containerId.or(containerName); // Interrupt the thread blocking on waitContainer stopAsync().awaitTerminated(); if (System.getenv("CONTAINER_STATS") != null) { tr...
java
public void stop() throws InterruptedException { // Tell docker to stop or eventually kill the container final String container = containerId.or(containerName); // Interrupt the thread blocking on waitContainer stopAsync().awaitTerminated(); if (System.getenv("CONTAINER_STATS") != null) { tr...
[ "public", "void", "stop", "(", ")", "throws", "InterruptedException", "{", "// Tell docker to stop or eventually kill the container", "final", "String", "container", "=", "containerId", ".", "or", "(", "containerName", ")", ";", "// Interrupt the thread blocking on waitContai...
Stops this container.
[ "Stops", "this", "container", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/agent/TaskRunner.java#L111-L135
117,399
spotify/helios
helios-tools/src/main/java/com/spotify/helios/cli/command/RollingUpdateCommand.java
RollingUpdateCommand.nullableWithFallback
private <T> T nullableWithFallback(final T first, final T second) { return first != null ? first : second; }
java
private <T> T nullableWithFallback(final T first, final T second) { return first != null ? first : second; }
[ "private", "<", "T", ">", "T", "nullableWithFallback", "(", "final", "T", "first", ",", "final", "T", "second", ")", "{", "return", "first", "!=", "null", "?", "first", ":", "second", ";", "}" ]
Return first argument if not null. Otherwise return second argument.
[ "Return", "first", "argument", "if", "not", "null", ".", "Otherwise", "return", "second", "argument", "." ]
c9000bc1d6908651570be8b057d4981bba4df5b4
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-tools/src/main/java/com/spotify/helios/cli/command/RollingUpdateCommand.java#L321-L323