private <T extends Serializable> void dispatch(List<? extends Serializable> messages, Class<T> messageClass, Handler<T> handler){ @SuppressWarnings("unchecked") List<T> filteredMessages = (List<T>) filter(Matchers.instanceOf(messageClass), messages); if (!messages.isEmpty()){ handler.handle(filteredMessages); } }
@Override public CompilationArtifact compile(SlangSource source, Set<SlangSource> dependencies) { Validate.notNull(source, "Source can not be null"); Set<SlangSource> dependencySources = new HashSet<>(filter(notNullValue(), dependencies)); try { return compiler.compile(source, dependencySources); } catch (Exception e) { logger.error("Failed compilation for source : " + source.getName() + " ,Exception is : " + e.getMessage()); throw new RuntimeException(e); } }
protected Set<Artifact> getDependencies( Matcher<? extends Artifact>... matchers ) { Set<Artifact> dependencies = getDependencies(); return new LinkedHashSet<Artifact>( filter( allOf( matchers ), dependencies ) ); }
public static <T> List<T> filterElements(final List<T> elements, final BeanMatcher... matchers) { List<T> filteredItems = ImmutableList.copyOf(elements); for(BeanFieldMatcher matcher : propertyMatchersIn(matchers)) { filteredItems = filter(matcher.getMatcher(), filteredItems); } return filteredItems; }
public static <T> List<T> filterElements(final List<T> elements, final BeanMatcher... matchers) { List<T> filteredItems = ImmutableList.copyOf(elements); for(BeanFieldMatcher matcher : propertyMatchersIn(matchers)) { filteredItems = filter(matcher.getMatcher(), filteredItems); } return filteredItems; }
public void addDependantObservation(MRSObservation mrsObservation) { List<? extends MRSObservation> existingObservationList = Lambda.filter(having(on(CouchObservation.class).getConceptName(), is(equalTo(mrsObservation.getConceptName()))), dependantObservations); if (!existingObservationList.isEmpty()) { dependantObservations.remove(existingObservationList.get(0)); } dependantObservations.add(convertObservationToCouchObservation(mrsObservation)); }
private List<TestOutcome> outcomesForRelease(List<? extends TestOutcome> outcomes, String releaseName) { releaseManager.enrichOutcomesWithReleaseTags(outcomes); return (List<TestOutcome>) filter(having(on(TestOutcome.class).getVersions(), hasItem(releaseName)), outcomes); } }
@Override public List<Alert> filter(List<Alert> alerts, AlertCriteria alertCriteria) { return Lambda.filter(having(on(Alert.class).getAlertType(), equalTo(alertCriteria.alertType())), alerts); } },
@Override public List<Alert> filter(List<Alert> alerts, AlertCriteria alertCriteria) { return Lambda.filter(having(on(Alert.class).getStatus(), equalTo(alertCriteria.alertStatus())), alerts); } },
private int countDataRowsWithResult(TestResult expectedResult) { List<DataTableRow> matchingRows = filter(having(on(DataTableRow.class).getResult(), is(expectedResult)), getDataTable().getRows()); return matchingRows.size(); }
private Properties appiumPropertiesFrom(EnvironmentVariables environmentVariables) { Properties appiumProperties = new Properties(); List<String> appiumKeys = filter(startsWith("appium."), environmentVariables.getKeys()); for (String key : appiumKeys) { String value = isAppProperty(key) ? appPathFrom(environmentVariables.getProperty(key)) : environmentVariables.getProperty(key); String simplifiedKey = key.replace("appium.", ""); appiumProperties.setProperty(simplifiedKey, value); } ensureAppPathDefinedIn(appiumProperties); return appiumProperties; }
private void addCustomPropertiesTo(Map<String, String> buildProperties) { List<String> sysInfoKeys = filter(startsWith("sysinfo."), environmentVariables.getKeys()); for(String key : sysInfoKeys) { String simplifiedKey = key.replace("sysinfo.", ""); String expression = environmentVariables.getProperty(key); String value = (isGroovyExpression(expression)) ? evaluateGroovyExpression(key, expression) : expression; buildProperties.put(humanizedFormOf(simplifiedKey), value); } }
/** * Find the test outcomes with a given tag type * * @param tagType the tag type we are filtering on * @return A new set of test outcomes for this tag type */ public TestOutcomes withTagType(String tagType) { return TestOutcomes.of(filter(havingTagType(tagType), outcomes)).withLabel(tagType).withRootOutcomes(this.getRootOutcomes()); }
/** * Find the test outcomes with a given tag type * * @param tagType the tag type we are filtering on * @return A new set of test outcomes for this tag type */ public TestOutcomes withTagType(String tagType) { return TestOutcomes.of(filter(havingTagType(tagType), outcomes)).withLabel(tagType).withRootOutcomes(this.getRootOutcomes()); }
/** * Find the test outcomes with a given tag name * * @param tagName the name of the tag type we are filtering on * @return A new set of test outcomes for this tag name */ public TestOutcomes withTag(String tagName) { return TestOutcomes.of(filter(havingTagName(tagName), outcomes)).withLabel(tagName).withRootOutcomes(getRootOutcomes()); }
/** * Find the test outcomes with a given tag name * * @param tagName the name of the tag type we are filtering on * @return A new set of test outcomes for this tag name */ public TestOutcomes withTag(String tagName) { return TestOutcomes.of(filter(havingTagName(tagName), outcomes)).withLabel(tagName).withRootOutcomes(getRootOutcomes()); }
public TestOutcomes getErrorTests() { return TestOutcomes.of(filter(withResult(TestResult.ERROR), outcomes)) .withLabel(labelForTestsWithStatus("failing tests")) .withRootOutcomes(getRootOutcomes()); }
public TestOutcomes getErrorTests() { return TestOutcomes.of(filter(withResult(TestResult.ERROR), outcomes)) .withLabel(labelForTestsWithStatus("failing tests")) .withRootOutcomes(getRootOutcomes()); }
/** * Find the failing test outcomes in this set * * @return A new set of test outcomes containing only the failing tests */ public TestOutcomes getFailingTests() { return TestOutcomes.of(filter(withResult(TestResult.FAILURE), outcomes)) .withLabel(labelForTestsWithStatus("failing tests")) .withRootOutcomes(getRootOutcomes()); }
public TestOutcomes havingResult(TestResult result) { return TestOutcomes.of(filter(withResult(result), outcomes)) .withLabel(labelForTestsWithStatus(result.name())) .withRootOutcomes(getRootOutcomes()); }