public void bePatternConfiguration(List<PsiClass> classes, PsiMethod method) { data.TEST_OBJECT = TestType.PATTERN.getType(); final String suffix; if (method != null) { data.METHOD_NAME = method.getName(); suffix = "," + data.METHOD_NAME; } else { suffix = ""; } LinkedHashSet<String> patterns = new LinkedHashSet<String>(); for (PsiClass pattern : classes) { patterns.add(JavaExecutionUtil.getRuntimeQualifiedName(pattern) + suffix); } data.setPatterns(patterns); final Module module = RunConfigurationProducer.getInstance(TestNGPatternConfigurationProducer.class) .findModule(this, getConfigurationModule().getModule(), patterns); if (module == null) { data.setScope(TestSearchScope.WHOLE_PROJECT); setModule(null); } else { setModule(module); } setGeneratedName(); }
@Override public void readExternal(Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); JavaRunConfigurationExtensionManager.getInstance().readExternal(this, element); readModule(element); DefaultJDOMExternalizer.readExternal(this, element); DefaultJDOMExternalizer.readExternal(getPersistantData(), element); EnvironmentVariablesComponent.readExternal(element, getPersistantData().getEnvs()); Map<String, String> properties = getPersistantData().TEST_PROPERTIES; properties.clear(); Element propertiesElement = element.getChild("properties"); if (propertiesElement != null) { List<Element> children = propertiesElement.getChildren("property"); for (Element property : children) { properties.put(property.getAttributeValue("name"), property.getAttributeValue("value")); } } List<String> listeners = getPersistantData().TEST_LISTENERS; listeners.clear(); Element listenersElement = element.getChild("listeners"); if (listenersElement != null) { List<Element> children = listenersElement.getChildren("listener"); for (Element listenerClassName : children) { listeners.add(listenerClassName.getAttributeValue("class")); } } final Element patternsElement = element.getChild(PATTERNS_EL_NAME); if (patternsElement != null) { final LinkedHashSet<String> tests = new LinkedHashSet<String>(); for (Object o : patternsElement.getChildren(PATTERN_EL_NAME)) { Element patternElement = (Element) o; tests.add(patternElement.getAttributeValue(TEST_CLASS_ATT_NAME)); } getPersistantData().setPatterns(tests); } }