/** * @return The list of all of the different tag types that appear in the test outcomes. */ public List<String> getTagTypes() { Set<String> tagTypes = Sets.newHashSet(); for (TestOutcome outcome : outcomes) { addTagTypesFrom(outcome, tagTypes); } return sort(ImmutableList.copyOf(tagTypes), on(String.class)); }
public Long getDuration() { if ((duration == 0) && (testSteps.size() > 0)) { return sum(testSteps, on(TestStep.class).getDuration()); } else { return duration; } }
/** * @return The list of all the tags associated with a given tag type. */ public List<TestTag> getTagsOfType(String tagType) { Set<TestTag> tags = Sets.newHashSet(); for (TestOutcome outcome : outcomes) { tags.addAll(tagsOfType(tagType).in(outcome)); } return sort(ImmutableList.copyOf(tags), on(String.class)); }
private static List<byte[]> extractSortValues(JSONArray expectedValuesArray) { Set<SortElement> elementsOrderedByScore = new TreeSet<RedisAssertion.SortElement>(); for (Object expectedObject : expectedValuesArray) { JSONObject expectedValue = (JSONObject) expectedObject; elementsOrderedByScore.add(new SortElement((java.lang.Number) expectedValue.get(SCORE_TOKEN), toByteArray(expectedValue.get(VALUE_TOKEN)))); } return extract(elementsOrderedByScore, on(SortElement.class).getValue()); }
/** * @return The list of TestOutcomes contained in this test outcome set. */ public List<? extends TestOutcome> getTests() { return sort(outcomes, on(TestOutcome.class).getTitle()); }
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)); }
/** * @return The total number of nested steps in these test outcomes. */ public int getStepCount() { return sum(extract(outcomes, on(TestOutcome.class).getNestedStepCount())).intValue(); }
public double getOverallStability() { if (outcomes.isEmpty()) { return 0.0; } else { return sum(outcomes, on(TestOutcome.class).getOverallStability()) / getTestCount(); } }
public List<TestTag> getTagsOfTypeExcluding(String tagType, String excludedTag) { Set<TestTag> tags = Sets.newHashSet(); for (TestOutcome outcome : outcomes) { List<TestTag> allTagsOfType = removeGeneralTagsFrom(tagsOfType(tagType).in(outcome)); allTagsOfType = removeExcluded(allTagsOfType, excludedTag); tags.addAll(allTagsOfType); } return sort(ImmutableList.copyOf(tags), on(String.class)); }
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); } }
private int countStepsWithResult(TestResult expectedResult, TestType testType) { int stepCount = sum(outcomes, on(TestOutcome.class).countNestedStepsWithResult(expectedResult, testType)); if ((stepCount == 0) && aMatchingTestExists(expectedResult, testType)) { return (int) Math.round(getAverageTestSize()); } return stepCount; }
public ManagedRedisLifecycleManager getStoppedServer(int port) { if(this.master.getPort() == port && !this.master.isReady()) { return this.master; } return selectFirst( this.slaveServers, having(on(ManagedRedisLifecycleManager.class).getPort(), is(port)).and(having(on(ManagedRedisLifecycleManager.class).isReady(), is(false)))); }
public ManagedRedisLifecycleManager getStartedServer(int port) { if(this.master.getPort() == port && this.master.isReady()) { return this.master; } return selectFirst( this.slaveServers, having(on(ManagedRedisLifecycleManager.class).getPort(), is(port)).and(having(on(ManagedRedisLifecycleManager.class).isReady(), is(true)))); }
@Override public String toString() { if (!hasChildren()) { return description; } else { String childDescriptions = join(extract(children, on(TestStep.class).toString())); return description + " [" + childDescriptions + "]"; } }
private static ColumnFamilyDefinition checkColumnFamilyName(List<ColumnFamilyDefinition> columnFamilyDefinitions, ColumnFamilyModel expectedColumnFamilyModel) throws Error { ColumnFamilyDefinition columnFamily = selectUnique(columnFamilyDefinitions, having(on(ColumnFamilyDefinition.class).getName(), equalTo(expectedColumnFamilyModel.getName()))); if (columnFamily == null) { throw FailureHandler.createFailure("Expected name of column family is %s but was not found.", expectedColumnFamilyModel.getName()); } return columnFamily; }
@Override public boolean matches(Object matchee) { TestOutcome testOutcome = (TestOutcome) matchee; return exists(testOutcome.getTags(), having(on(TestTag.class).getName(), equalToIgnoringCase(tagName))); }