/** * @param assertable * @param categoryAssertionsMap * @return assertion categories mapped with assertions in exact category if @param assertable is * not null only assertions for specific @param assertable will be included if @param * assertable is null all assertions are included */ public LinkedHashMap<String, SortedSet<AssertionListEntry>> addCategoriesAssertionsMap( Assertable assertable, LinkedHashMap<String, SortedSet<AssertionListEntry>> categoryAssertionsMap) { for (String category : AssertionCategoryMapping.getAssertionCategories()) { SortedSet<AssertionListEntry> assertionCategorySet = new TreeSet<AssertionListEntry>(); categoryAssertionsMap.put(category, assertionCategorySet); } for (TestAssertionFactory assertion : availableAssertions.values()) { SortedSet<AssertionListEntry> set; if (assertable == null || assertion.canAssert(assertable)) { set = categoryAssertionsMap.get(assertion.getCategory()); if (set != null) { AssertionListEntry assertionListEntry = assertion.getAssertionListEntry(); // if( assertable == null && disableNonApplicable ) set.add(assertionListEntry); categoryAssertionsMap.put(assertion.getCategory(), set); } } } for (String category : AssertionCategoryMapping.getAssertionCategories()) { if (categoryAssertionsMap.get(category).isEmpty()) { categoryAssertionsMap.remove(category); } } return categoryAssertionsMap; }
public boolean canAssert(String type, Assertable assertable) { TestAssertionFactory factory = availableAssertions.get(type); if (factory != null) { return factory.canAssert(assertable); } else { return false; } }
public boolean canAssert(String type, TestModelItem modelItem, String property) { TestAssertionFactory factory = availableAssertions.get(type); if (factory != null) { return factory.canAssert(modelItem, property); } else { return false; } }
public AssertionListEntry getAssertionListEntry(String type) { TestAssertionFactory factory = availableAssertions.get(type); if (factory != null) { return factory.getAssertionListEntry(); } else { return null; } }
public String[] getAvailableAssertionNames(Assertable assertable) { List<String> result = new ArrayList<String>(); for (TestAssertionFactory assertion : availableAssertions.values()) { if (assertion.canAssert(assertable)) { result.add(assertion.getAssertionLabel()); } } return result.toArray(new String[result.size()]); }
public Class<? extends WsdlMessageAssertion> getAssertionClassType(String assertionType) { try { TestAssertionFactory factory = availableAssertions.get(assertionType); if (factory == null) { log.error("Missing assertion for type [" + assertionType + "]"); } else { return factory.getAssertionClassType(); } } catch (Exception e) { SoapUI.logError(e); } return null; }
public WsdlMessageAssertion buildAssertion(TestAssertionConfig config, Assertable assertable) { try { String type = config.getType(); TestAssertionFactory factory = availableAssertions.get(type); if (factory == null) { log.error("Missing assertion for type [" + type + "]"); } else { return (WsdlMessageAssertion) factory.buildAssertion(config, assertable); } } catch (Exception e) { SoapUI.logError(e); } return null; }
/** adds all assertions into map, to be disabled later when non applicable */ public LinkedHashMap<String, SortedSet<AssertionListEntry>> addAllCategoriesMap( LinkedHashMap<String, SortedSet<AssertionListEntry>> categoryAssertionsMap) { for (String category : AssertionCategoryMapping.getAssertionCategories()) { SortedSet<AssertionListEntry> assertionCategorySet = new TreeSet<AssertionListEntry>(); categoryAssertionsMap.put(category, assertionCategorySet); } for (TestAssertionFactory assertion : availableAssertions.values()) { SortedSet<AssertionListEntry> set; set = categoryAssertionsMap.get(assertion.getCategory()); if (set != null) { AssertionListEntry assertionListEntry = assertion.getAssertionListEntry(); set.add(assertionListEntry); categoryAssertionsMap.put(assertion.getCategory(), set); } } for (String category : AssertionCategoryMapping.getAssertionCategories()) { if (categoryAssertionsMap.get(category).isEmpty()) { categoryAssertionsMap.remove(category); } } return categoryAssertionsMap; }
public void removeFactory(TestAssertionFactory factory) { availableAssertions.remove(factory.getAssertionId()); assertionLabels.remove(factory.getAssertionLabel()); }
public void addAssertion(TestAssertionFactory factory) { availableAssertions.put(factory.getAssertionId(), factory); assertionLabels.put(factory.getAssertionLabel(), factory.getAssertionId()); }