/** * Returns only one instance to insert. * @return Instance to insert. */ @Override protected final Collection<Object> getInstances() { return List.of(instance); }
/** * Returns a list with the queryable instance to execute the delete. * @return Queryable instance. */ @Override protected Collection<Object> getInstances() { return List.of(queryable); }
/** * Returns the instance that contains the information to update the instances. * @return Object that contains the new values. */ @Override protected Collection<Object> getInstances() { return List.of(instance); }
/** * Get headers by name. If not exists, return empty list */ public List<String> getHeaders(String name) { requireNonNull(name); return map.getOrDefault(name, List.of()); }
/** * Create request body send x-www-form-encoded data, with UTF-8 charset. */ public static Body<List<Param>> wwwForm(Param... params) { requireNonNull(params); return new FormBody(List.of(params), UTF_8); }
/** * Set url query params. * * @param params the parameters */ public final T params(Param... params) { this.params = List.of(params); return self(); }
/** * Create multi-part encoded request body, from several Parts. */ public static Body<List<Part>> multiPart(Part... parts) { requireNonNull(parts); return new MultiPartBody(List.of(parts)); }
@Override public Map<String, List<String>> get(URI uri, Map<String, List<String>> requestHeaders) throws IOException { var headers = super.get(uri, requestHeaders); var userList = requestHeaders.getOrDefault(HeaderNames.COOKIE, List.of()); var sessionList = headers.getOrDefault(HeaderNames.COOKIE, List.of()); var cookieValues = Lists.concat(userList, sessionList); if (cookieValues.isEmpty()) { return Map.of(); } return Map.of(HeaderNames.COOKIE, cookieValues); } }
@Override public CompletableFuture<? extends Subspace> createOrOpen(Tuple key) { // To create a nested subdirectory per tuple item, use: directory.createOrOpen(db, t.stream().map(o -> (String) o).collect(Collectors.toList()) return directorySubspaceByPaths.computeIfAbsent(key, k -> directory.createOrOpen(db, List.of(k.toString()))); } }
/** * Set request headers. */ public final T headers(Header... headers) { headers(List.of(headers)); return self(); }
/** * This method verify if the conditions of the query are true or not. * @param object Object to use as condition parameters. * @return Returns if the evaluation of conditions are true or false in the otherwise. */ public final boolean verifyCondition(Object object) { Consumer consumer = new Queryable.IntrospectionConsumer<>(); Collection collection = List.of(object); return verifyCondition(object, Q->collection, consumer); }
public static TestSpecificationElement objectNode(SpecificationElementType elementType, String name, Set<TestSpecificationElement> properties) { TestSpecificationElement mapElement = new TestSpecificationElement(name, elementType, Set.of("object"), List.of(), Set.of(), new TreeMap<>(properties.stream().collect(Collectors.toMap(e -> e.getName(), e -> e))), null); properties.forEach(e -> e.parent(mapElement)); return mapElement; }
/** * Set request cookies. */ public final T cookies(Cookie... cookies) { cookies(List.of(cookies)); return self(); }
private DistributedLock getDistributedLock(Object... path) { DistributedLock distributedLock; synchronized (sharedStore) { distributedLock = (DistributedLock) sharedStore.getInstance(path); if (distributedLock == null) { distributedLock = new DistributedLock(); distributedLock.setStatus(DistributedLock.Status.UNLOCKED); addLocalObject(distributedLock, List.of(thisNode.getId()), List.of(), System.currentTimeMillis(), path); } } return distributedLock; }
public static List<ProcessInstanceBean> filterProcessInstance(String processDefinitionKey, Map<String, Object> variablesEquals) { String processVariables = getVariablesPathEquals(variablesEquals); return filterProcessInstanceBase(List.of(processDefinitionKey), Map.of(VARIABLES, processVariables)); }
public static List<ProcessInstanceBean> filterProcessInstance(String processDefinitionKey, Map<String, Object> variablesEquals) { String processVariables = getVariablesPathEquals(variablesEquals); return filterProcessInstanceBase(List.of(processDefinitionKey), Map.of(VARIABLES, processVariables)); }
public static TestSpecificationElement arrayNode(String name, TestSpecificationElement items) { TestSpecificationElement arrayNode = new TestSpecificationElement(name, SpecificationElementType.EMBEDDED, Set.of("array"), List.of(), Set.of(), Map.of(), items); items.parent(arrayNode); return arrayNode; }
@Test void testParseUnitInvalid() { for (String invalid : List.of("1Kib", "-1b", " 1b", "1 b", "1b ", "1tb")) { assertThatCode(() -> ByteValue.of(invalid)).isInstanceOf(IllegalArgumentException.class); } }
@Test void testCulprit() { when(stacktraceConfiguration.getApplicationPackages()).thenReturn(List.of("org.example.stacktrace")); final ErrorCapture errorCapture = new ErrorCapture(tracer); final Exception nestedException = new Exception(); final Exception topLevelException = new Exception(nestedException); errorCapture.setException(topLevelException); assertThat(errorCapture.getCulprit()).startsWith("org.example.stacktrace.ErrorCaptureTest.testCulprit(ErrorCaptureTest.java:"); assertThat(errorCapture.getCulprit()).endsWith(":" + nestedException.getStackTrace()[0].getLineNumber() + ")"); }
@Test void testDisabledMetrics() { when(config.getDisableMetrics()).thenReturn(List.of(WildcardMatcher.valueOf("jvm.gc.*"))); final DoubleSupplier problematicMetric = () -> { throw new RuntimeException("Huston, we have a problem"); }; metricRegistry.addUnlessNegative("jvm.gc.count", emptyMap(), problematicMetric); metricRegistry.addUnlessNan("jvm.gc.count", emptyMap(), problematicMetric); metricRegistry.add("jvm.gc.count", emptyMap(), problematicMetric); assertThat(metricRegistry.getMetricSets()).isEmpty(); } }