Package com.consol.citrus.annotations

Examples of com.consol.citrus.annotations.CitrusXmlTest


     */
    @BeforeClass(alwaysRun = true)
    public void createTestRunners() {
        for (Method method : ReflectionUtils.getAllDeclaredMethods(this.getClass())) {
            if (method.getAnnotation(CitrusXmlTest.class) != null) {
                CitrusXmlTest citrusTestAnnotation = method.getAnnotation(CitrusXmlTest.class);

                String[] testNames = new String[] {};
                if (citrusTestAnnotation.name().length > 0) {
                    testNames = citrusTestAnnotation.name();
                } else if (citrusTestAnnotation.packageScan().length == 0) {
                    // only use default method name as test in case no package scan is set
                    testNames = new String[] { method.getName() };
                }

                String testPackage;
                if (StringUtils.hasText(citrusTestAnnotation.packageName())) {
                    testPackage = citrusTestAnnotation.packageName();
                } else {
                    testPackage = method.getDeclaringClass().getPackage().getName();
                }

                List<TestRunner> methodTestRunners = new ArrayList<TestRunner>();
                testRunners.put(method.getName(), methodTestRunners);

                for (String testName : testNames) {
                    methodTestRunners.add(createTestRunner(testName, testPackage));
                }

                String[] testPackages = citrusTestAnnotation.packageScan();
                for (String packageName : testPackages) {
                    try {
                        Resource[] fileResources = new PathMatchingResourcePatternResolver().getResources(packageName.replace('.', '/') + "/**/*Test.xml");

                        for (Resource fileResource : fileResources) {
View Full Code Here


        for (IMethodInstance method : methods) {
            interceptedMethods.add(method);

            if (method.getInstance() instanceof AbstractTestNGCitrusTest) {
                CitrusXmlTest citrusXmlTestAnnotation = method.getMethod().getConstructorOrMethod().getMethod().getAnnotation(CitrusXmlTest.class);
                if (citrusXmlTestAnnotation != null) {
                    if (citrusXmlTestAnnotation.name().length > 1) {
                        for (int i = 1; i < citrusXmlTestAnnotation.name().length; i++) {
                            interceptedMethods.add(new MethodInstance(method.getMethod()));
                        }
                    }

                    String[] packagesToScan = citrusXmlTestAnnotation.packageScan();
                    for (String packageName : packagesToScan) {
                        try {
                            Resource[] fileResources = new PathMatchingResourcePatternResolver().getResources(packageName.replace('.', '/') + "/**/*Test.xml");
                            for (int i = 1; i < fileResources.length; i++) {
                                interceptedMethods.add(new MethodInstance(method.getMethod()));
View Full Code Here

TOP

Related Classes of com.consol.citrus.annotations.CitrusXmlTest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.